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"
}
| Member | Meaning |
|---|---|
type | Stable 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. |
title | Fixed human-readable summary of the category. Never varies per occurrence. |
status | Duplicates the HTTP status code, so the body is self-contained when detached from its response. |
detail | The specific message for this occurrence. May vary; do not parse it. |
instance | The 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 suffix | title | Raised by |
|---|---|---|
malformed-request-body | Malformed request body | JSON that does not decode, a missing required field, or a present-but-empty/invalid cutoffAt |
reference-required | Reference query parameter is required | GET /work-units without reference |
invalid-quantity | Invalid quantity | negative quantity |
invalid-path-id | Invalid path id | empty pathId |
unknown-path-id | Unrecognized process-path id | a pathId no declared process-path prefix matches (ADR-0012) |
work-unit-id-required | Work unit id is required | empty id |
work-unit-reference-required | Work unit reference is required | empty reference |
invalid-line-no | Invalid line number | POST /paths/{pathId}/work-units with a lineNo below 1 or above 2147483647 (the 32-bit column limit; ADR-0036) |
work-pool-entry-not-found | Work unit not found in this pool | releasing an unknown entry |
invalid-wip-limit | Invalid WIP limit | PUT /paths/{pathId}/pool with a wipLimit ≤ 0 (ADR-0034) |
unknown-feed-mode | Unknown work pool feed mode | PUT /paths/{pathId}/pool with a mode other than ReleaseFed/FlowFed |
idempotency-key-required | Idempotency-Key header is required | any POST without an Idempotency-Key header (ADR-0022, ADR-0047) |
idempotency-key-invalid | Idempotency-Key header is invalid | an Idempotency-Key that is not 1-128 printable ASCII characters |
invalid-limit | Invalid limit | GET /work-units with a limit outside 1-500, empty or repeated |
invalid-cursor | Invalid cursor | GET /work-units with a cursor that does not decode, or a repeated cursor |
unknown-query-parameter | Unknown query parameter | GET /work-units with a query parameter it does not declare (e.g. the retired after, offset, nextToken) |
unknown-pick-unit | Unknown pick unit | POST /paths/{pathId}/work-units with a pickUnit other than EACH/CASE (ADR-0045) |
invalid-pick-plan | Invalid pick plan | POST /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-break | Invalid case break | POST /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-quantity | Invalid pick quantity | the 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 suffix | title | Raised by |
|---|---|---|
no-active-case-level | The SKU has no active CASE pack level | POST /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-multiple | Quantity is not a whole number of cases | POST /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 suffix | title | Raised by |
|---|---|---|
idempotency-key-reused | Idempotency-Key was already used with a different request | any 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 suffix | title | Raised by |
|---|---|---|
not-found | Resource not found | no 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 suffix | title | Invariant |
|---|---|---|
wip-limit-reached | Release-fed pool WIP limit reached | WIP-limit backpressure |
work-pool-entry-already-released | Work pool entry already released | at-most-once handout |
work-unit-already-enqueued | Work unit already enqueued in this pool | no duplicate entries |
work-pool-empty | Work pool is empty | nothing pending to release |
work-unit-already-released | Work unit already released | at most one active assignment |
work-unit-already-completed | Work unit already completed | no double-complete |
work-unit-not-released | Work unit not released | must be released before completing |
work-unit-cancelled | Work unit cancelled | a 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-modification | The work pool was modified concurrently; retry the request | optimistic-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 suffix | title |
|---|---|
internal-error | Internal 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 statusproblemFor(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.