Skip to main content

Error model — RFC 7807

Every error response from this service is RFC 7807 Problem Details, served with Content-Type: application/problem+json. There is no bespoke {"error": "..."} shape anywhere. See ADR-0005.

curl -sD - localhost:8080/paths/does-not-exist/telemetry
HTTP/1.1 404 Not Found
Content-Type: application/problem+json

{
"type": "https://errors.wes-work-planning.warehouse-systems.dev/not-found",
"title": "Resource not found",
"status": 404,
"detail": "resource not found",
"instance": "/paths/does-not-exist/telemetry"
}
MemberMeaning
typeStable per-category identifier. It does not need to resolve to a real page — RFC 7807 permits that, and it is namespaced per service so type URIs never collide across the platform. Match on this, not on detail.
titleFixed human-readable summary of the category. Never varies per occurrence.
statusDuplicates the HTTP status code, so the body is self-contained when detached from its response.
detailThe specific message for this occurrence. May vary; do not parse it.
instanceThe request path that produced the problem.

The full catalogue​

All type URIs are prefixed https://errors.wes-work-planning.warehouse-systems.dev/.

400 Bad Request — the request is malformed or violates a domain rule​

type suffixtitleRaised by
malformed-request-bodyMalformed request bodyJSON that does not decode, a missing required field, or a present-but-empty/invalid cutoffAt
reference-requiredReference query parameter is requiredGET /work-units without reference
invalid-quantityInvalid quantitynegative quantity
invalid-path-idInvalid path idempty pathId
unknown-path-idUnrecognized process-path ida pathId no declared process-path prefix matches (ADR-0012)
work-unit-id-requiredWork unit id is requiredempty id
work-unit-reference-requiredWork unit reference is requiredempty reference
invalid-line-noInvalid line numberPOST /paths/{pathId}/work-units with a lineNo below 1 or above 2147483647 (the 32-bit column limit; ADR-0036)
work-pool-entry-not-foundWork unit not found in this poolreleasing an unknown entry
invalid-wip-limitInvalid WIP limitPUT /paths/{pathId}/pool with a wipLimit ≤ 0 (ADR-0034)
unknown-feed-modeUnknown work pool feed modePUT /paths/{pathId}/pool with a mode other than ReleaseFed/FlowFed
idempotency-key-requiredIdempotency-Key header is requiredany POST without an Idempotency-Key header (ADR-0022, ADR-0047)
idempotency-key-invalidIdempotency-Key header is invalidan Idempotency-Key that is not 1-128 printable ASCII characters
invalid-limitInvalid limitGET /work-units with a limit outside 1-500, empty or repeated
invalid-cursorInvalid cursorGET /work-units with a cursor that does not decode, or a repeated cursor
unknown-query-parameterUnknown query parameterGET /work-units with a query parameter it does not declare (e.g. the retired after, offset, nextToken)
unknown-pick-unitUnknown pick unitPOST /paths/{pathId}/work-units with a pickUnit other than EACH/CASE (ADR-0045)
invalid-pick-planInvalid pick planPOST /paths/{pathId}/work-units with an incomplete or inconsistent pick: pickUnit or fromBin without a quantity, no sku, a quantity below 1, both a pick and a case break, or a pick on a path other than the pick path
invalid-case-breakInvalid case breakPOST /paths/{pathId}/work-units with an incomplete caseBreak, a caseBreak combined with quantity/pickUnit/fromBin, or a case break on a path other than the case-break path
invalid-pick-quantityInvalid pick quantitythe pick-load estimate (pickload.Estimate) asked for fewer than 1 each; POST /paths/{pathId}/work-units rejects such a quantity first, as invalid-pick-plan

410 Gone — retired​

charge-forecast-moved and shift-plan-moved were answered for one release (v2.0.3) by the two moved planning routes. Stage E of ADR-0049 removed POST /paths/{pathId}/charge and POST /paths/{pathId}/plan; a POST to either now answers 404. Send the forecast as warehouse-planning's PUT /workload-forecasts/{site_id}/{path_id} and the plan as its PUT /labour-plans/{site_id}/{shift_id}/{path_id}.

422 Unprocessable Entity​

type suffixtitleRaised by
no-active-case-levelThe SKU has no active CASE pack levelPOST /paths/{pathId}/work-units with a CASE pick for a SKU with no active CASE level in the local pack copy (ADR-0045)
quantity-not-case-multipleQuantity is not a whole number of casesPOST /paths/{pathId}/work-units with a CASE pick whose quantity (eaches) is not a multiple of the units per case

409 Conflict — key reuse​

type suffixtitleRaised by
idempotency-key-reusedIdempotency-Key was already used with a different requestany POST re-using an Idempotency-Key with a different method, path or body — use a new key for a genuinely different request. Distinguished from business 409s by the problem type

404 Not Found​

type suffixtitleRaised by
not-foundResource not foundno aggregate or projection exists for that key

Both read-model endpoints return 404 when nothing has been observed yet — deliberately, rather than a zero-valued body. "No observation" and "observed zero" are different facts.

409 Conflict — the request is well-formed but the state forbids it​

type suffixtitleInvariant
wip-limit-reachedRelease-fed pool WIP limit reachedWIP-limit backpressure
work-pool-entry-already-releasedWork pool entry already releasedat-most-once handout
work-unit-already-enqueuedWork unit already enqueued in this poolno duplicate entries
work-pool-emptyWork pool is emptynothing pending to release
work-unit-already-releasedWork unit already releasedat most one active assignment
work-unit-already-completedWork unit already completedno double-complete
work-unit-not-releasedWork unit not releasedmust be released before completing
work-unit-cancelledWork unit cancelleda RELOCATE move cancelled by a newer slot plan for its site is never released (ADR-0040); releasing it or completing it (POST /work-units/{id}/completions) is refused with this slug, never work-unit-not-released
concurrent-modificationThe work pool was modified concurrently; retry the requestoptimistic-concurrency retry budget (12 attempts) exhausted on a WorkPool save (ADR-0029)

409 is the right code here because these are state conflicts, not input errors: the same request would have succeeded a moment earlier, and retrying it unchanged will not help — except concurrent-modification, which is the one 409 a client should simply retry.

500 Internal Server Error​

type suffixtitle
internal-errorInternal server error

The fallback for anything unmapped — an adapter failure, not a domain outcome. Every domain error the service can raise has an explicit mapping above, so a 500 here genuinely means infrastructure.

How the mapping is structured​

Two pure functions in internal/adapters/inbound/http/errors.go:

  • statusFor(err) int — sentinel error → HTTP status
  • problemFor(err) (typeURI, title) — sentinel error → RFC 7807 identity

They mirror each other case for case: every sentinel statusFor recognises has a corresponding case in problemFor, so no error can get a correct status with a generic problem type. Both use errors.Is, so wrapped errors keep their mapping. This includes the two Idempotency-Key problems raised by the route-scoped middleware (errIdempotencyKeyRequired → 400, errIdempotencyKeyReused → 409): the middleware calls writeError rather than building problem bodies inline.

Keeping this in the adapter is the point. The domain returns typed sentinel errors and knows nothing about HTTP; a second inbound adapter (the Kafka consumer) handles the same errors completely differently, without either adapter's policy leaking into the other.