Skip to content

Error Response Reference

Every error response in an ergo pipeline uses RFC 9457 Problem Details format (Content-Type: application/problem+json). This page is the consolidated reference for all possible error responses — organized by the pipeline stage that produces them.

The transport layer runs before the four-stage pipeline. These responses are produced by the router dispatch logic and transport middleware (request ID, security headers, rate limiting, CORS preflight).

StatusSourceConditionRFC
404 Not FoundRouterNo route matches the request pathRFC 9110 §15.5.5
405 Method Not AllowedRouterPath exists but method not registered (includes Allow header)RFC 9110 §15.5.6
415 Unsupported Media TypeRouter (strictPatch)PATCH with Content-Type not in application/json, application/merge-patch+json, application/json-patch+json (includes Accept-Patch header)RFC 9110 §15.5.16
415 Unsupported Media TypeRouter (strictBody)POST/PUT without Content-Type headerRFC 9110 §15.5.16
429 Too Many RequestsTransport rate limitRequest count exceeds transport.rateLimit.maxRFC 6585 §4
403 ForbiddenTransport CORSPreflight OPTIONS request with disallowed originFetch Standard

Content negotiation middleware runs first — there is no point authenticating or validating a request the server cannot meaningfully respond to.

StatusSourceConditionRFC
403 Forbiddencors()Origin header present but not allowed by policyFetch Standard
406 Not Acceptableaccepts()Any negotiated value is undefined and throwIfFail is trueRFC 9110 §12.5
428 Precondition Requiredprecondition()Neither If-Match nor If-Unmodified-Since header presentRFC 6585 §3
429 Too Many RequestsrateLimit()Per-route request count exceeds max within windowMsRFC 6585 §4

Authentication and authorization middleware rejects unauthorized callers before any request body parsing occurs.

StatusSourceConditionRFC
400 Bad Requestauthorization()Bearer: authorizer returns info.type: 'invalid_request'RFC 6750 §3.1
401 Unauthorizedauthorization()Missing or invalid credentials (Bearer default; missing header with configured strategies)RFC 6750 §3.1
403 Forbiddenauthorization()Basic auth failure; Bearer insufficient_scope; no configured strategies; custom scheme rejectionRFC 6750 §3.1 / RFC 7617
403 Forbiddencsrf()Missing header token, missing UUID cookie, or CSRF token verification failsOWASP CSRF

Input validation middleware parses and validates the request body, query parameters, and idempotency keys.

StatusSourceConditionRFC
400 Bad Requestbody()Content-Length mismatch, malformed body, or parse failureRFC 9110
400 Bad Requestidempotency()Idempotency-Key header present but not a valid RFC 8941 sf-stringRFC 8941
400 Bad Requestidempotency()Idempotency-Key header absent and required: trueIETF draft
400 Bad RequestjsonApiQuery()Query parameters fail JSON:API schema validationJSON:API
409 Conflictidempotency()Same key with different request fingerprint, or concurrent request still processingIETF draft
411 Length Requiredbody()Neither Content-Length nor chunked encoding presentRFC 9110 §15.5.12
413 Payload Too Largebody()Body exceeds limit (or decompressed body exceeds decompressedLimit)RFC 9110 §15.5.14
415 Unsupported Media Typebody()Unrecognized content type or unsupported Content-EncodingRFC 9110 §15.5.16
422 Unprocessable Entityvalidate()JSON Schema validation failure — response includes details array with per-field errorsRFC 9110 §15.5.21
500 Internal Server Errorvalidate()Body schema configured but acc.body is missing — body() middleware not placed before validate()

Execution-stage middleware wraps the handler and post-processes the response. These responses come from timeout(), send() conditional request evaluation, and uncaught pipeline errors.

StatusSourceConditionRFC
204 No Contentsend()Prefer: return=minimal on 2xx responses (200 → 204)RFC 7240
304 Not Modifiedsend()If-None-Match weak-matches the ETag, or If-Modified-Since and resource not modifiedRFC 9110 §15.4.5
408 Request Timeouttimeout()Default — deadline exceededRFC 9110 §15.5.9
412 Precondition Failedsend()If-Match fails on unsafe methods, or If-Unmodified-Since failsRFC 9110 §15.5.13
500 Internal Server Errorhandler() / auto-wrapUncaught pipeline error (detail is redacted for security)
504 Gateway Timeouttimeout()When configured with statusCode: 504RFC 9110 §15.6.5