Error Codes

Comprehensive error handling guide for MPPFi - the first neobank infrastructure for AI agents built on Solana blockchain with Machine Payments Protocol.

Error Response Format

All API errors follow this standardized structure:

{
  "error": {
    "type": "invalid_request_error",
    "code": "insufficient_balance",
    "message": "Agent has insufficient balance for this transaction",
    "param": "amount",
    "request_id": "req_abc123xyz",
    "status_code": 400
  }
}

Response Fields:

  • type - Error category (see Error Types below)

  • code - Specific error code for programmatic handling

  • message - Human-readable error description

  • param (optional) - Parameter that caused the error

  • request_id - Unique request identifier for support

  • status_code - HTTP status code


Error Types

authentication_error

Authentication failed - invalid or missing API key.

HTTP Status Code: 401

Example Response:

Common Causes:

  • Missing Authorization header

  • Invalid API key format

  • Expired or revoked API key

  • Using test key in production environment

How to Fix:


invalid_request_error

Request is malformed or contains invalid parameters.

HTTP Status Code: 400

Example Response:

Common Error Codes:

  • missing_required_param - Required field not provided

  • invalid_param_value - Parameter value is invalid

  • invalid_currency - Unsupported currency (must be USDC)

  • invalid_amount - Amount format invalid (must be decimal string)

  • invalid_solana_address - Solana address format invalid

How to Fix:


insufficient_balance_error

Agent account has insufficient USDC balance.

HTTP Status Code: 400

Example Response:

How to Fix:


policy_violation_error

Transaction violates agent's on-chain policy rules.

HTTP Status Code: 403

Example Response:

Common Violation Types:

  • amount_limit_exceeded - Transaction or daily limit exceeded

  • merchant_not_allowed - Merchant not on allowlist

  • merchant_blocked - Merchant on blocklist

  • time_restriction - Transaction outside allowed hours

  • approval_required - Multi-signature approval needed

  • velocity_limit_exceeded - Too many transactions in period

How to Fix:


rate_limit_error

Too many requests in a short period.

HTTP Status Code: 429

Example Response:

How to Handle:


blockchain_error

Solana blockchain transaction failed or is pending.

HTTP Status Code: 500

Example Response:

Common Blockchain Errors:

  • transaction_failed - On-chain transaction failed

  • transaction_timeout - Transaction didn't confirm in time

  • network_congestion - Solana network is congested

  • insufficient_sol_for_fee - Not enough SOL for transaction fee

How to Handle:


not_found_error

Requested resource does not exist.

HTTP Status Code: 404

Example Response:

Common Resource Types:

  • agent_not_found - Agent account doesn't exist

  • payment_not_found - Payment doesn't exist

  • policy_not_found - Policy doesn't exist

  • merchant_not_found - Merchant doesn't exist

  • webhook_not_found - Webhook endpoint doesn't exist

How to Handle:


server_error

Internal server error occurred.

HTTP Status Code: 500, 502, 503

Example Response:

What to Do:

  1. Retry the request with exponential backoff

  2. If persistent, check status page: https://status.mppfi.xyz

  3. Contact support with request_id


Complete Error Code Reference

Authentication Errors (401)

Code
Description
Resolution

invalid_api_key

API key is invalid or malformed

Verify API key format and value

expired_api_key

API key has expired

Generate new API key

revoked_api_key

API key was manually revoked

Create new API key

missing_api_key

No API key provided

Include Authorization header

test_key_in_production

Test key used in production

Use production API key

Request Errors (400)

Code
Description
Resolution

missing_required_param

Required parameter missing

Include required field

invalid_param_value

Parameter value invalid

Check parameter format

invalid_currency

Currency not supported

Use USDC

invalid_amount

Amount format invalid

Use decimal string (e.g., "100.50")

invalid_solana_address

Solana address invalid

Verify address is valid base58

invalid_merchant_id

Merchant ID invalid

Check merchant exists

invalid_policy_rule

Policy rule configuration invalid

Review policy rule structure

Agent Errors

Code
Description
Resolution

agent_not_found

Agent account doesn't exist

Verify agent ID or create agent

agent_suspended

Agent account is suspended

Reactivate agent account

agent_closed

Agent account is closed

Create new agent account

insufficient_balance

Agent has insufficient USDC

Fund agent account

agent_limit_reached

Maximum agents created

Contact support to increase limit

Payment Errors

Code
Description
Resolution

payment_not_found

Payment doesn't exist

Verify payment ID

payment_already_completed

Payment already processed

Check payment status

payment_already_cancelled

Payment already cancelled

Cannot reprocess

payment_failed

Payment execution failed

Check error details and retry

duplicate_idempotency_key

Idempotency key already used

Use unique idempotency key

merchant_not_available

Merchant temporarily unavailable

Retry later

mpp_protocol_error

MPP protocol error

Check MPP parameters

Policy Errors (403)

Code
Description
Resolution

policy_not_found

Policy doesn't exist

Verify policy ID

policy_violation

Transaction violates policy

Adjust transaction or policy

amount_limit_exceeded

Amount limit exceeded

Reduce amount or update policy

merchant_not_allowed

Merchant not on allowlist

Add merchant to allowlist

merchant_blocked

Merchant on blocklist

Remove from blocklist

time_restriction

Outside allowed time window

Wait for allowed time

approval_required

Multi-sig approval needed

Obtain required approvals

velocity_limit_exceeded

Too many transactions

Wait for velocity window reset

Blockchain Errors (500)

Code
Description
Resolution

transaction_failed

On-chain transaction failed

Check blockchain explorer

transaction_timeout

Transaction didn't confirm

Retry transaction

network_congestion

Solana network congested

Retry with higher priority

insufficient_sol_for_fee

Not enough SOL for fees

Contact support (should auto-manage)

invalid_transaction

Transaction structure invalid

Contact support

Webhook Errors

Code
Description
Resolution

webhook_not_found

Webhook doesn't exist

Verify webhook ID

webhook_delivery_failed

Failed to deliver event

Check endpoint availability

invalid_webhook_signature

Signature verification failed

Check signing secret

webhook_url_invalid

Webhook URL invalid

Provide valid HTTPS URL


SDK Error Handling Examples

TypeScript

Python

Rust

Go


Best Practices

1. Always Handle Errors Explicitly

2. Use Type-Specific Error Handlers

3. Log Request IDs for Support

4. Implement Retry Logic for Transient Errors

5. Validate Before API Calls


Monitoring and Alerting

Track Error Rates

Alert on Critical Errors


Getting Help

If you encounter persistent errors:

  1. Check Status Page: https://status.mppfi.xyz

  2. Review Documentation: https://docs.mppfi.xyz

  3. Search Known Issues: https://github.com/mppfi/issues

  4. Contact Support: [email protected]

    • Include request_id from error response

    • Describe steps to reproduce

    • Include relevant code snippets

    • Mention SDK version and environment


Next Steps

Last updated

Was this helpful?