Skip to main content

Troubleshooting

Every row is derived from a failure path in the code. Logs are JSON on stdout; the messages quoted are the stable substrings (Observability).

Boot and readiness​

SymptomCauseCheckFix
api exits 1 at once with invalid configuration: and a listA mandatory variable is missing. One error line per variable: DATABASE_URL is required, KAFKA_BROKERS is required, <…>_CONSUMER_GROUP is requiredthe lines name every missing variableset them (Configuration); in Helm the chart refuses to render without them
api or mcp exits with SHUTDOWN_DRAIN_DELAY "x" is not a non-negative durationunparsable drain delaythe message names the valueuse a Go duration (5s, 0)
api or mcp logs boot step failed; retrying step=run migrations or ping postgres, then exitsPostgres unreachable, wrong DSN or credentials, or a sidecar not yet ready (6 attempts, doubling from 500 ms)the error field of the last attemptfix the DSN / network; if DATABASE_URL is behind PgBouncer set a direct MIGRATIONS_DATABASE_URL
api exits listen on :8080: …port in useHTTP_ADDRchange it
/readyz answers 503 {"status":"not_ready"}the process is draining after SIGTERMpod is terminatingexpected; wait for the replacement
/readyz answers 503 problem dependency-unavailablePostgres ping or the Kafka topic-less metadata request failed (cached 3 s, bounded 2 s)the problem names the dependency; WARN readiness: dependency is not ready has errorrestore the broker/database; with one broker, a single broker restart makes every pod unready
api pod restarts with a consumer died; shutting downa Kafka reader failed unrecoverably; a dead consumer would silently stop feeding the local copies, so the process exitsthe ERROR line gives <consumer> died and the reader errorfix Kafka connectivity; the pod restarts and resumes from the committed offsets
relay exits with code 2 DATABASE_URL is required / KAFKA_BROKERS is required / OUTBOX_POLL_INTERVAL … is not a positive durationrelay configurationexit code and the first log linefix the variable
relay logs outbox relay pass failed repeatedly right after a fresh installthe relay does not migrate; the outbox table does not exist yetwhether the api or mcp ever started against this databasestart cmd/api (or cmd/mcp) once; the relay's next poll succeeds
yard-reports never becomes readyit reads the analytics freshness table; the projector has not created the analytics schema/readyz 503 naming analytics; projector logsstart cmd/yard-projector with a direct ANALYTICS_DATABASE_URL; check its boot error
yard-projector exits at boot naming ANALYTICS_DATABASE_URLthe analytical migrations or ping failed (run analytics migrations on …, open analytics pool on …, ping …)the wrapped erroruse a direct DSN of a role allowed to create the analytics schema
projector exits analytics consumer stopped unexpectedlythe consumer loop returned (reader failure); a projector that consumes nothing must not keep answering probesthe wrapped errorfix Kafka; the pod restarts

Events are not leaving (outbox)​

SymptomCauseCheckFix
Writes succeed but no event appears on warehouse.yard-management.events, outbox growsno relay running (relay.enabled: false), or the relay cannot reach KafkaSELECT count(*), min(created_at) FROM outbox;; relay logs; kubectl get deploy for the relayenable and start the relay; fix broker reachability
WARN outbox relay: send failed, stopping this pass at the failed rowbroker down or rejected the write; the row backs off 1 s, 2 s, 4 s … up to 5 min and later rows wait behind itoutbox.attempts, outbox.last_errorrestore Kafka; the relay recovers by itself
ERROR outbox relay: row reached the attempt cap and is excluded from future claimsthe row failed OUTBOX_MAX_ATTEMPTS (20) times; later rows now overtake it (per-key order is not guaranteed past a stuck row, ADR 0004)log fields outbox_id, topic, event_type, key, errorfix the cause (topic ACL, size limit, broker), then UPDATE outbox SET attempts = 0, next_attempt_at = now() WHERE id = <outbox_id>;
WARN outbox relay: dead-lettered a row the encoder refusesthe row's payload is not valid JSON, has no data, or names an event outside the published catalogue (encoder.go, published)the message on warehouse.yard-management.events.dlq, header dlq-reasona code bug: the row is already deleted from outbox; replay from the DLQ value after fixing the producer
Analytics topic has the event, the integration topic does notby design: ten event types are analytics-only (VisitCheckedOut, TrailerParked, DoorWorkStarted, TrailerHeld, TrailerHoldReleased, five YardMove*)Eventsnone
the same event arrives twiceat-least-once: a crash between send and commit republishes the row with the same CloudEvents idduplicate idconsumers dedupe on id (this service does so in processed_events)

Consumers​

SymptomCauseCheckFix
ERROR <consumer> handling failed; retrying the same message with growing attempta transient failure (database down, lock timeout). The same message is retried forever with backoff 200 ms to 5 s and blocks its partitionerror, partition, offsetfix the database; no skip exists by design, so a message is never silently lost
Local copies (locations, appointments) stay emptythe consumer group is new and the topic is empty, the group id changed (it starts from the first offset, so it replays), or the upstream never publishedconsumer-group lag on the broker; event consumed INFO linescheck the group env value is the stable one; check upstream
WARN skipping a message that is not a valid CloudEventa producer wrote a non-CloudEvents message on the topicthe topic fieldfix the producer; the message is committed past (it cannot be dead-lettered: its type is unknowable)
Messages appear on <topic>.dlqpoison message of a handled type: payload does not decode, blank natural id, no version, no window (ERROR message can never be applied)headers x-dlq-source-topic, x-dlq-cause; the value is the original messagefix the producer; replay the value
A consumed event has no effectits CloudEvents type has no handler here (ignored) or its id was already claimed in processed_eventsthe message type against the consumed types in Integrationnone; or delete the processed_events row only if a deliberate replay is needed
A check-in refuses an appointment that existsthe appointment copy is stale or missing (unknown-appointment) or its door is closedappointments, door_closures tableswait for or replay the dock-scheduling events

API refusals​

Errors are application/problem+json; the slug is the last segment of type (https://errors.yard-management.warehouse-systems.dev/<slug>).

SymptomCauseFix
400 idempotency-key-required / idempotency-key-invalida POST/PUT without the header, or a key that is not 1-128 printable ASCII characterssend a unique key per logical request (not needed on the two sweeps)
409 idempotency-key-reusedthe same key with another method, path or body (also while the key still holds a stored answer; after a RETRYABLE refusal the key is free and another body is a new request)use a new key; to retry, send the identical request
409 concurrent-modificationthe aggregate was changed by another request (version guard); any POST or PUT can answer it except the two sweeps, which skip what changedre-read and retry, with the same Idempotency-Key or a new one: this refusal is RETRYABLE, nothing is stored under the key and the retry runs the command again (ADR 0019)
A refusal that "stays" under a key: 4xx with Idempotency-Replayed: truethe problem type is FINAL (the same request cannot pass: validation, invalid-*, visit-not-found and the other ids this service minted, precondition-failed, inspection-closed, ...) or OUTCOME (carrier-suspended); the table is in ADR 0019change the request, or send a new key once what the refusal names is fixed
409 / 404 / 422 that passes on a retry with the same key (visit-already-open, trailer-on-hold, location-occupied, no-claimable-move, unknown-location, unknown-appointment, unknown-template, ...)RETRYABLE: the answer depends on state that changes (a visit checks out, a hold is released, a spot frees, a facility or dock-scheduling event arrives); nothing was stored under the keyretry with the same key once the state is right; if it still refuses, read the problem detail
412 precondition-failed on PUT /sites/{siteId}/yard-policyIf-Match is not the policy's current versionGET the policy, send its ETag
400 invalid-if-matchIf-Match is not an entity tag of a policy versionsend the ETag returned by GET
400 unknown-query-parameter, invalid-limit, invalid-cursor, invalid-statelist endpoints reject unknown parameters, bad limit, a cursor not produced by the service, a state outside the enumfix the query
400 invalid-report-range, invalid-threshold-minutesfrom/to must be RFC 3339, to after from, at most 92 days; thresholdMinutes an integer from 1 to 10080fix the query
409 visit-already-openan open visit exists for that plate at the site (unique index uq_yard_visits_one_open_per_plate)check the visit out first
409 appointment-requiredthe site's yard policy has requireAppointmentsend a booked appointmentId or change the policy
409 no-free-spotno free Yard slot for the trailer (also when the facility feed has not loaded the site)free a spot, or load the layout
409 location-occupied, destination-reserved, trailer-has-open-movea spot or door holds a trailer or is reserved by an open move; one open move per trailer (partial unique indexes)wait or choose another destination
409 door-closed, door-flow-mismatcha door closure copy covers it; the door's flow (Inbound/Outbound/Both) does not match the trailerpick another door or wait for DoorClosureLifted
409 trailer-on-hold / trailer-not-on-holdmove or release of a held trailer / release of one not heldrelease the hold first
409 trailer-not-released, seal-requiredcheck-out of a trailer that is not on site, still has an open move, is DOCKED with door work not DONE, or is a LOADED outbound trailer without a sealfinish the work, close the move, record the seal (POST /trailers/{trailerId}/seals)
409 door-work-openreleasing the securing (POST /trailers/{trailerId}/securing-releases) while door work is IN_PROGRESS (ADR 0013); check-out answers trailer-not-released firstcomplete the door work first
409 hostler-busy, not-lease-holder, lease-not-expireda hostler can hold one claimed move; only the lease holder completes itcomplete or cancel the current move
404 no-claimable-movePOST /moves/claims found no REQUESTED hostler move at the siteexpected when idle
a CLAIMED move is not released after the leasethe lease sweep did not run (the CronJob is the only scheduler)kubectl get cronjob; run POST /move-lease-sweeps by hand; the default lease is 300 s
no TrailerDwellExceeded eventsthe dwell sweep did not run, or the site's policy has no dwellThresholdMinutes for that trailer kindthe CronJob, GET /sites/{siteId}/yard-policy
409 trailer-not-secureddoor work started on a trailer that is not secured and the site yard policy has requireSecuringBeforeDoorWork true (ADR 0013)record the securing (POST /trailers/{trailerId}/securings, a restraint or wheel chocks), or turn the policy off
409 inspection-requiredthe site yard policy has requiredInspections for the gate (PRE_DOCK move to a door, PRE_LOAD door work on a trailer being loaded, PRE_DEPARTURE check-out) and the trailer has no completed inspection of that template at that gate (ADR 0015)open, fill in and complete one (POST /trailers/{trailerId}/inspections, PUT /inspections/{id}/items/{itemCode}, POST /inspections/{id}/completions), or drop the rule from the policy
409 inspection-failedthe latest completed inspection of the required template at that gate FAILED (the failed required item also held the trailer)release the hold (POST /trailers/{trailerId}/hold-releases) after the fix, then pass a new inspection of the same template and gate
409 trailer-still-secureda move off the door, or the check-out, of a trailer whose restraint or chocks were recorded and not releasedPOST /trailers/{trailerId}/securing-releases once the restraint is off, then retry
409 seal-class-too-lowthe site yard policy has minimumSealClass and the seal at check-in or record-seal is of a lower class or has nonesend a sealClass at or above the minimum, or change the policy
409 carrier-suspendeddock-scheduling suspended the carrier (carrierScac) and the site yard policy has suspendedCarrierAction REJECT; the visit is recorded as REJECTED with reason CARRIER_SUSPENDED although the call fails; a retry under the same Idempotency-Key replays the stored 409 and records nothing newcheck the carrier standing with dock-scheduling; reinstate it there, or set suspendedCarrierAction to FLAG (admit and flag) or NONE
422 invalid-unit-numbera CONTAINER (or a unit declared unitNumberScheme: ISO6346) whose number is not a valid ISO 6346 number; the detail names the expected check digitcorrect the number, or the kind if it is not a container
409 placement-rule-violateda trailer that declares a hazard class was sent to a yard spot that is not HAZMAT (or the site has no HAZMAT spot and the policy does not allowHazmatOnUnclassifiedSpots), or a trailer that requires temperature control to a spot that is not REEFER_PLUG at a site that has plugs (ADR 0014); the detail names the rule and the spotchoose a spot of the right kind (the facility-layout spotKind), correct the trailer's declaration with POST /trailers/{trailerId}/classifications, or have the site publish HAZMAT or REEFER_PLUG spots
422 invalid-hazmat-class, invalid-un-numbera hazard class that is not a US DOT class or division (1 to 9, 1.4, 2.1...), or a UN number that is not UN and four digits (ADR 0014)send a valid value or leave the field out
422 invalid-seal-classa seal class (or the policy's minimumSealClass) that is not I, S or Huse one of the three
422 unknown-location, unknown-appointment, invalid-carrier, validation, unexplained-destinationa value or reference the model refuses; locations and appointments are event-fed copiesfix the body; check the copies are loaded
400 malformed-request-body or 404 resource-not-found on a NUL characterU+0000 is refused uniformly (it would be a Postgres error otherwise): in the query or the body it is the 400, in the path the 404remove it
404 resource-not-foundthe path matches no route (or carries a NUL character)check the path against the endpoint table of the API overview
405 method-not-allowedthe path exists and does not take that method; the Allow header lists the ones it takesuse a listed method
500 internal-erroran unexpected error; the cause is only in the log (request failed, method, path, error)find the ERROR line
GET /reports/* on the api returns rows emptyANALYTICS_READER_DATABASE_URL is unset on the api, so it answers the contract shape with no rowsset it, or call yard-reports; the MCP get_yard_dwell_report tool always answers no rows (the reader is not wired in cmd/mcp)
/reports/* rows are stalethe projector is behind or downGET /reports/freshness; projector logs and lag of its group

MCP​

SymptomCauseFix
mcp exits DATABASE_URL is required / KAFKA_BROKERS is requiredboth are mandatory although the binary starts no consumer: writes enqueue outbox rows and /readyz reports the brokerset them
MCP writes succeed but no event is publishedno relay is runningstart cmd/relay
a tool returns an internal-error resultunexpected error, logged as mcp tool failed with an unexpected errorread the log