Skip to content

Error Reference

ErrorMeaningWhat to inspect
MpesaValidationErrorInput or config is incomplete or malformedConstructor config, environment variables, phone numbers, callback URLs
MpesaAuthErrorOAuth token fetch failedCredentials, environment mismatch, network reachability
MpesaRequestErrorDaraja returned a non-OK response or the request failed at the transport layerstatusCode, responseBody, and your request payload
MpesaCallbackErrorA callback body does not match the expected shapeRaw callback body and route selection
  • The SDK error name
  • statusCode for MpesaRequestError
  • responseBody for request and auth failures
  • Your own correlation identifiers such as order IDs and CheckoutRequestID
  • Synchronous request success means the request was accepted, not completed.
  • Final success or failure usually arrives through the async callback route.
  • For STK callbacks, ResultCode === 0 is success. A common failure example is user-cancelled STK authorization with 1032.

Normalize your own application error shape around the SDK errors rather than matching raw Daraja strings directly. responseBody is useful for debugging but not stable enough to become your business logic contract.