New here? Start with the Quick Start flow first — most errors below are state or sequencing issues that disappear once the happy path works.
Symptom-cause-fix recipes for the most common OFFER-HUB API failures — auth, idempotency, state transitions, escrow, webhooks, SSE reconnects, and provider timeouts — plus how to use /health/detailed and X-Request-ID when contacting support.
This guide maps the most common OFFER-HUB failures to their causes and fixes. Every scenario below was verified against the Orchestrator source in the OFFER-HUB/OFFER-HUB repository — each fix cites the guard, service, exception, or DTO file that produces the behavior, so nothing here is guessed.
New here? Start with the Quick Start flow first — most errors below are state or sequencing issues that disappear once the happy path works.
Every failed request returns the standard error envelope, produced by the global exception filter (global-exception.filter.ts):
Three things to do with every error:
error.code — it is stable and machine-checkable; error.message is human-readable and may change.error.details — filters and guards attach context (current state, required scope, field errors) that usually names the exact fix.X-Request-ID response header — the correlation-ID middleware (correlation-id.middleware.ts) echoes your X-Request-ID request header or generates a UUID, and you will need it for support (see Reporting an issue).The full code catalog lives in docs/api/errors.md in the Orchestrator repo, and maps to typed SDK exceptions in SDK Errors.
401 with "Missing Authorization header"401 UNAUTHORIZED and message Missing Authorization header.Authorization header at all. The API-key guard (api-key.guard.ts) rejects it before any route logic runs.Authorization: Bearer ohk_live_... on every request. If you use the SDK, check that apiKey is set in Configuration — an empty string produces exactly this.401 with "Invalid API Key"401 and message Invalid API Key (or Invalid API Key format).INVALID_API_KEY.OFFERHUB_API_KEY everywhere.403 with "Insufficient scope"403 INSUFFICIENT_SCOPE on a route that works in your admin client but fails from your integration; error.details names the required scope.scope.guard.ts) compares your key's scopes against the @Scopes() metadata on the handler and throws ForbiddenException('Insufficient scope').read, write, and support. Create a key with write for any mutating route (POST/PUT/PATCH/DELETE) and reserve support for dispute operations — see API Overview — Authentication. Retrying cannot help; fix the key.400 VALIDATION_ERROR with field details400 and error.details lists fields like amount or currency.INVALID_AMOUNT_FORMAT and MISSING_REQUIRED_FIELD."50.00", never 50), and currency must be supported by your instance. Send exactly the fields the DTO declares — extra nesting (a double-wrapped {"data": {...}}) is the most common cause.400 "Idempotency-Key must be a valid UUID v4"400 VALIDATION_ERROR mentioning the Idempotency-Key header.idempotency.guard.ts) validates the header with isValidUuidV4 and rejects anything that is not a UUID v4 — including timestamps, order IDs, or uuid v1 values.crypto.randomUUID() in Node, uuid.uuid4() in Python). The key only applies to POST/PUT/PATCH; omitting it means no idempotency protection at all (the guard passes the request through).409 IDEMPOTENCY_KEY_REUSED409 with This idempotency key was used with a different request body.IdempotencyService.checkOrLock (idempotency.service.ts) hashes the request body; the stored hash for this key does not match. Keys are scoped to the API key, so two marketplaces can reuse a key safely.409 IDEMPOTENCY_KEY_IN_PROGRESS409 with Original request still processing.idempotency:lock:..., 60-second TTL) has not been released.POST and got the original response — same body, same status — instead of an error or a second execution.IdempotencyReplayException (idempotency-replay.exception.ts), which replays the stored status and body verbatim. Records are retained for 24 hours.withIdempotencyKey — see SDK Configuration.404 USER_NOT_FOUND / ORDER_NOT_FOUND404 on a route that worked moments ago, often right after creating the resource.localhost do not exist on the deployed instance, and IDs created with one API key are invisible to a key from another marketplace.422 INSUFFICIENT_FUNDS422 with details.required and details.available when reserving or funding.INSUFFICIENT_FUNDS.InsufficientFundsError with required/available properties — then top up via the Deposits guide before retrying.409 INVALID_STATE on a transition409 INVALID_STATE, e.g. Cannot reserve funds order ord_123 in state FUNDS_RESERVED or Order ord_123 is in state ESCROW_FUNDING, but ESCROW_FUNDED is required for this operation.InvalidOrderStateException (orders.exceptions.ts) and InvalidResolutionStateException (resolution.exceptions.ts) fire when you skip a step: releasing before the escrow is funded, funding twice, or disputing a closed order.GET the order, compare its status against the order lifecycle, and issue transitions in sequence: ORDER_CREATED → reserve → FUNDS_RESERVED → escrow create/fund → ESCROW_FUNDED → IN_PROGRESS → release/refund. The SDK raises InvalidTransitionError for these; never retry it blindly.The diagram shows the only path the state machine accepts — every 409 INVALID_STATE in T11–T13 is an attempt to skip an arrow on it.
409 ESCROW_ALREADY_EXISTS409 with Escrow already exists for order ord_123 when calling the escrow creation route.EscrowAlreadyExistsException — the order already has an escrow contract; creating one twice is not allowed.409 ESCROW_NOT_READY (release/refund before funding completes)409 ESCROW_NOT_READY — escrow is not in the correct state for this operation.CREATING/FUNDING and you tried to release, refund, or dispute. The catalog entry is ESCROW_NOT_READY (see docs/api/errors.md).order.escrow_funded event (or poll GET the order) and act only when status is IN_PROGRESS. See Escrow Flows for the Trustless Work webhook lifecycle that drives these transitions.409 DISPUTE_ALREADY_OPEN409 with Active dispute already exists for order ord_123, or the release/refund route fails with the same code.DisputeAlreadyExistsException / ActiveDisputeException — one open dispute per order, and resolution actions are blocked while it is open. Requesting release and refund simultaneously also fails with 409 INVALID_STATE (MutuallyExclusiveResolutionException).401401 / WEBHOOK_SIGNATURE_INVALID; deposits never credit.handleAirtmWebhook (webhooks.controller.ts) using the Svix headers svix-id, svix-timestamp, svix-signature and svix.Webhook.verify(rawBody, headers) in airtm-webhook.service.ts. A mismatch — wrong AIRTM_WEBHOOK_SECRET, a proxy that rewrote the body, or forwarding to a different URL — fails closed.AIRTM_WEBHOOK_SECRET is unset, verification is disabled with a logged warning — fine for local dev, never for production. Full reference: Inbound Webhooks.401401; order status stays stuck at ESCROW_CREATING.x-tw-signature header — HMAC-SHA256(rawBody, TRUSTLESS_WEBHOOK_SECRET) as a hex digest (webhook.service.ts) — and throws UnauthorizedException with WEBHOOK_SIGNATURE_INVALID on mismatch. The secret must match the value in the Trustless Work dashboard (values not starting with tw_whsec_ log a warning).TRUSTLESS_WEBHOOK_SECRET with the provider, and make sure you sign the raw body, not a re-serialized JSON.Trustless Work webhook received without signature header, yet the event was processed.when (signature) is present — a missing header logs a warning and processing continues (webhooks.controller.ts). This is a documented development gap, not production behavior.TRUSTLESS_WEBHOOK_SECRET; do not expose a signature-less webhook publicly.Webhooks are answered 200 even when business processing fails ({ "status": "ok", "processed": false }) and duplicates return { "status": "ok", "duplicate": true } — so a 200 never proves the event was applied. Dedup is keyed on (provider, providerEventId). Judge outcomes by order/balance state, not by the HTTP status alone.
interval(30000) in events.controller.ts); proxies that buffer or time out idle responses kill it. Replay comes from a Redis sorted set (events:log) capped at the last 1,000 events (sse.service.ts) — a client that was offline for more than the retention window simply has no backlog, and filter values are exact-match only.Last-Event-ID (takes precedence over since) to resume inside the window, poll GET endpoints as a fallback for gaps, and disable proxy buffering for /api/v1/events. The stream is protected by ApiKeyGuard only — if the stream never opens, fix the key (T1/T2), not scopes. Full reference: Events.502 PROVIDER_ERROR or PROVIDER_RATE_LIMITED502 with details.provider naming the failing integration; sometimes details.retryRecommended: true.PROVIDER_ERROR, PROVIDER_RATE_LIMITED).ProviderError (see SDK Errors — retry semantics). If it persists, check /health/detailed for the provider's status.504 PROVIDER_TIMEOUT — did my transaction go through?504 PROVIDER_TIMEOUT after a fund, release, or withdrawal call; you do not know whether the on-chain transaction executed.Idempotency-Key so an accidental duplicate stays a replay. See Withdrawals.429 RATE_LIMITED429 after a burst of requests; disappears a minute later.rate-limit.guard.ts) enforces a per-API-key Redis bucket — 100 requests per 60 seconds by default.RateLimitError. If you legitimately need more, spread traffic across keys by marketplace rather than hammering one.500 INTERNAL_ERROR500 with no specific code; possibly a stack trace in details on non-production instances.INTERNAL_ERROR.X-Request-ID response header and report it — see below.Before debugging client code, confirm the Orchestrator itself is healthy.
GET /health returns a minimal liveness payload from health.controller.ts:
GET /health/detailed runs real dependency checks (database, Redis, AirTM, Trustless Work) through the health service and reports each one:
Any dependency other than up explains a whole class of failures: redis: down produces T7/T18-style symptoms, trustlessWork: down produces T13/T16. Both endpoints are public — wire them into your uptime checks (see Self-Hosting).
When an error persists and you need help, the correlation-ID middleware makes any request traceable:
X-Request-ID header (any UUID v4) on the failing request — or read the X-Request-ID response header; the server generates one when you do not supply it (correlation-id.middleware.ts).error.code, the exact request (method, path, body — redact secrets), and the timestamp.metadata.correlationId field of events emitted by the request, so it connects the API call, the resulting state changes, and the SSE trail.Never include API keys or webhook secrets in a report. The request ID is enough to trace everything.
Answers for participants building on OFFER-HUB under time pressure.
What do I need before my first API call?
A running Orchestrator instance and an API key (ohk_live_...). Follow Installation then Quick Start — ten minutes end to end.
Testnet or mainnet?
Use a local or testnet instance for the hackathon; Stellar testnet USDC is free. Base URLs and keys are per-environment — mixing them is the #1 cause of T9 (404).
Do I have to handle webhooks?
Not to get started. Webhooks drive automatic status updates, but polling GET on the order works for a demo — combine it with SSE (Events) for near-real-time without any public endpoint. Configure webhook secrets only if you self-host.
How do I retry safely without double-charging?
Send an Idempotency-Key (UUID v4) on every mutating request and retry with the same key and identical body — you will get the stored response instead of a second execution (T8). Never reuse a key for a changed payload (T6).
My escrow call succeeded but release fails with 409.
On-chain steps are async. Wait for IN_PROGRESS (T13); watch the order.* events or poll the order.
The SSE stream works locally but not from my deployed frontend. Proxies and serverless functions buffer or kill idle streams. Disable buffering, or poll on an interval for the demo (T18).
I keep getting 429.
Default is 100 requests/minute per key (T21). The SDK backs off automatically; in a demo loop, add a short sleep or cache responses.
Where do I see the full list of error codes?
The API Overview table, the SDK Errors catalog, and the Orchestrator repo's docs/api/errors.md.
Something is broken and I cannot tell if it is my code or the API.
Check /health/detailed first. Then re-run the failing call with an X-Request-ID header, capture the response header, and include the ID plus the error.code when you ask for help — that single ID traces the request end to end.
Can buyer and seller be the same user?
No — creating an order with identical buyer and seller throws 400 INVALID_REQUEST (SameUserException). Create two users, even for testing.
My deposit completed on-chain but the balance did not update. Balance credit for crypto deposits is detected automatically; if it stalls, the Trustless Work webhook chain is the usual suspect — check the webhook logs and secrets (T16), then confirm via balance.