{ "error": { "code": "INSUFFICIENT_FUNDS", "message": "Available balance is less than requested amount", "details": { "available": "50.00", "requested": "100.00", "currency": "USDC" } }}Complete error code catalog for the OFFER-HUB Orchestrator — 40+ domain-specific codes, HTTP status mapping, error envelope format, correlation headers, and SDK error mappings.
The OFFER-HUB Orchestrator returns standard, machine-readable JSON error envelopes for all failed requests. Every error includes a persistent machine code, a human-readable message, an optional domain-specific details payload, and a correlation request identifier.
All error responses are generated centrally by GlobalExceptionFilter (apps/api/src/common/filters/global-exception.filter.ts) using the canonical code catalog defined in packages/shared/src/constants/error-codes.ts.
All API error responses follow the standard envelope format:
When a request fails DTO schema validation (VALIDATION_ERROR), the details.validationErrors array contains the exact property path and validation rule failure messages from NestJS ValidationPipe (apps/api/src/common/pipes/validation.pipe.ts):
X-Request-ID)Every incoming request gets a correlation ID. It is either the incoming X-Request-ID header value, used as is, or a UUID v4 generated by CorrelationIdMiddleware (apps/api/src/common/middleware/correlation-id.middleware.ts). Where it appears in success and error bodies is covered in Request correlation.
The correlation ID is returned on every response in the X-Request-ID HTTP header and included in all backend structured log lines:
Always include the X-Request-ID header value when reporting unexpected errors (500 INTERNAL_ERROR or 502 PROVIDER_ERROR) to support or inspecting server audit logs.
The diagram below illustrates how client requests traverse authentication, validation, domain service logic, and the central exception filter to produce structured error envelopes or SDK exception instances:
When using @offerhub/sdk, the HTTP client inspects error.code and statusCode to raise typed JavaScript/TypeScript exception subclasses extending OfferHubError.
For the complete SDK exception class hierarchy, retry options, and client catching patterns, see SDK Errors.
The tables below list all 40+ error codes grouped by domain, citing the exact controller, service, DTO, or guard in the Orchestrator implementation.
auth)Implemented in apps/api/src/common/guards/api-key.guard.ts, apps/api/src/common/guards/scopes.guard.ts, apps/api/src/modules/auth/auth.service.ts, and apps/api/src/modules/auth/strategies/jwt.strategy.ts.
validation)Implemented in apps/api/src/common/pipes/validation.pipe.ts, apps/api/src/common/filters/global-exception.filter.ts, and shared DTOs in packages/shared/src/dto/.
users)Implemented in apps/api/src/modules/users/users.service.ts, apps/api/src/modules/users/users.controller.ts, and apps/api/src/common/guards/user-status.guard.ts.
funds)Implemented in apps/api/src/modules/balances/balances.service.ts, apps/api/src/modules/orders/orders.service.ts, and apps/api/src/modules/balances/balances.controller.ts.
orders)Implemented in apps/api/src/modules/orders/orders.service.ts, apps/api/src/modules/orders/orders.controller.ts, and packages/shared/src/state-machines/order.machine.ts.
escrow)Implemented in apps/api/src/modules/orders/orders.service.ts, apps/api/src/modules/resolution/resolution.service.ts, and apps/api/src/providers/trustless-work/trustless-work.service.ts.
disputes)Implemented in apps/api/src/modules/disputes/disputes.service.ts, apps/api/src/modules/disputes/disputes.controller.ts, and apps/api/src/modules/resolution/resolution.service.ts.
topups)Implemented in apps/api/src/modules/topups/topups.service.ts, apps/api/src/modules/topups/topups.controller.ts, and apps/api/src/providers/airtm/services/airtm.service.ts.
withdrawals)Implemented in apps/api/src/modules/withdrawals/withdrawals.service.ts, apps/api/src/modules/withdrawals/withdrawals.controller.ts, and apps/api/src/providers/stellar/services/stellar.service.ts.
providers)Implemented in apps/api/src/modules/webhooks/webhooks.controller.ts, apps/api/src/modules/webhooks/guards/webhook-signature.guard.ts, and apps/api/src/providers/.
idempotency)Implemented in apps/api/src/common/interceptors/idempotency.interceptor.ts and apps/api/src/common/guards/idempotency.guard.ts.
rate limit)Implemented in apps/api/src/common/guards/rate-limit.guard.ts and apps/api/src/common/filters/global-exception.filter.ts.
internal)Implemented in apps/api/src/common/filters/global-exception.filter.ts, apps/api/src/common/filters/prisma-exception.filter.ts, and apps/api/src/modules/health/health.controller.ts.
@offerhub/sdk error classes, exception inheritance, and retry strategiesrelease, refund, and dispute error scenarios