Skip to main content

Errors

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

The shape​

curl -i -X POST localhost:8080/associates/ghost/certifications \
-d '{"certification":"hazmat"}'
HTTP/1.1 404 Not Found
Content-Type: application/problem+json

{
"type": "https://errors.workforce-management.warehouse-systems.dev/resource-not-found",
"title": "Resource not found",
"status": 404,
"detail": "not found",
"instance": "/associates/ghost/certifications"
}
MemberSemantics
typeIdentifies the error category. Fixed per sentinel domain error, not per occurrence. It is a stable identifier and does not need to resolve — RFC 7807 explicitly permits this.
titleThe fixed, category-level human summary. Same for every occurrence of a type.
statusThe HTTP status, duplicated in the body per the RFC.
detailThe specific message for this occurrence — carries the underlying err.Error() text. This is the only member that varies between two responses of the same category.
instanceThe request path that produced the error.

The type/title versus detail split is the part clients should build on: switch on type, show detail.

Status mapping​

Typed domain errors are mapped to HTTP status in the inbound adapter — the domain layer knows nothing about HTTP.

StatusWhen
400 Bad RequestMalformed JSON, or a value object that refuses to construct (empty id, empty certification), or a missing required query/body field
404 Not Foundports.ErrNotFound — the associate or the committed plan does not exist
409 ConflictA domain invariant refused the operation (the request was well-formed; the domain said no), or an Idempotency-Key reused with a different request (idempotency-key-reused)
422 Unprocessable Entityshared.ErrConflictingSiteAndBuilding — the request named the ShiftPlan key twice (siteCode and the deprecated buildingId) with different values. Not raised by the three staffing-gap reads (see below)
500 Internal Server ErrorAnything unmapped — a repository or publisher failure
503 Service UnavailableCommitShiftPlan could not verify installed capacity against fulfillment-execution (ADR 0014) — retry later

409 is the interesting one. It is used for every invariant rejection — certification missing, associate on break, planned heads over installed stations — because these are all "the current state of the resource conflicts with what you asked for," which is precisely what 409 means. They are not 422: the payload is valid and processable, the domain state disagrees.

Every problem type​

Base URI: https://errors.workforce-management.warehouse-systems.dev

400 — validation​

type suffixtitleSentinel
/empty-associate-idAssociate id must not be emptyshared.ErrEmptyAssociateId
/empty-path-idPath id must not be emptyshared.ErrEmptyPathId
/unknown-path-idUnrecognized process-path idpathcatalog.ErrUnknownPath
/empty-certificationCertification must not be emptyshared.ErrEmptyCertification
/missing-building-idsiteCode is required (buildingId is a deprecated alias)shared.ErrMissingSiteKey — neither siteCode nor buildingId was sent. The slug keeps its historic name so existing clients keep matching it (ADR 0035)
/missing-shift-idshiftId is requiredHTTP-layer sentinel
/shift-plan-no-path-plansShift plan must have at least one path plan lineshiftplan.ErrNoPathPlans
/shift-plan-missing-installed-stationsMissing installed station count for pathshiftplan.ErrMissingInstalledStations
/malformed-request-bodyMalformed request bodyfallback for any unmatched 400

404 — not found​

type suffixtitleSentinel
/resource-not-foundResource not foundports.ErrNotFound

409 — invariant conflict​

type suffixtitleSentinel
/certification-requiredAssociate lacks the certification required for this pathassignment.ErrCertificationRequired
/associate-on-breakAssociate on break cannot be assignedassociate.ErrOnBreak
/associate-already-on-breakAssociate is already on breakassociate.ErrAlreadyOnBreak
/associate-not-on-breakAssociate is not on breakassociate.ErrNotOnBreak
/associate-shift-endedAssociate shift has already endedassociate.ErrShiftEnded
/max-hours-exceededMax hours per shift exceededassociate.ErrMaxHoursExceeded
/planned-heads-exceed-installedPlanned heads exceed installed stations for pathshiftplan.ErrPlannedHeadsExceedInstalled
/exceeds-installed-capacityPlanned heads exceed the live installed capacity reported by fulfillment-executionshiftplan.ErrExceedsInstalledCapacity
/planned-hours-exceed-capacityPlanned hours exceed capacity for planned heads within max hours per shiftshiftplan.ErrPlannedHoursExceedCapacity

422 — unprocessable​

type suffixtitleSentinel
/conflicting-site-and-buildingsiteCode and its deprecated alias buildingId have different valuesshared.ErrConflictingSiteAndBuilding — a request carried both names of the ShiftPlan key with different values (ADR 0035)

The 422 rule is applied by the shift-plan commit and the plan-proposal surfaces (ResolveSiteKey). It is deliberately not applied to the three staffing-gap reads (GET /paths/{pathId}/staffing-gap, GET /buildings/{buildingId}/shifts/{shiftId}/staffing-gap?siteCode=, MCP get_staffing_gap): a differing pair is accepted there, buildingId being the plan key and siteCode the scope, for the whole deprecation window (ADR 0035, "Decided (2026-10-08)"; shared.ResolveGapLookup).

The idempotency middleware's idempotency-key-reused is a 409, not a 422 (ADR 0027, ADR 0040).

500 — unmapped​

type suffixtitle
/internal-errorInternal server error

503 — dependency unavailable​

type suffixtitleSentinel
/installed-capacity-unavailableCould not verify installed capacity against fulfillment-executionports.ErrInstalledCapacityUnavailable

Worked example: the certification gate​

curl -i -X POST localhost:8080/associates/assoc-1/assignments \
-d '{"pathId":"hazmat"}'
HTTP/1.1 409 Conflict
Content-Type: application/problem+json

{
"type": "https://errors.workforce-management.warehouse-systems.dev/certification-required",
"title": "Associate lacks the certification required for this path",
"status": 409,
"detail": "associate lacks the certification required for this path",
"instance": "/associates/assoc-1/assignments"
}

The client switches on type — a stable, machine-readable identifier — and displays detail. Adding a new failure mode to the domain adds a new type; it never changes the shape or the meaning of an existing one.

Guarantees​

  • Every error path produces a well-formed problem document. Errors that match no category fall back to a status-keyed generic one, so there is no route through the adapter that emits a bare string or an empty body.
  • The Content-Type is application/problem+json on every error, and application/json on every success.
  • title never varies for a given type; detail always may.
  • Every mapping above is asserted by an httptest test against the real chi router, and the 409 paths are additionally covered by the godog acceptance specs.