Skip to main content

Troubleshooting

Source: cmd/*/config.go, internal/adapters/inbound/http/errors.go, internal/adapters/outbound/outbox/relay.go, internal/adapters/inbound/kafka/*, charts/dock-scheduling/. Log messages are listed in Observability; variables in Configuration.

Boot and readiness​

SymptomCauseCheckFix
Pod exits at once, log ... is requiredA mandatory variable is missing. The boot error names every missing one: DATABASE_URL, KAFKA_BROKERS, and for cmd/api the four *_CONSUMER_GROUP; ANALYTICS_DATABASE_URL for the projector and reports.kubectl logs of the first start: dock-scheduling api exited with error.Set the value (chart: database.*, kafka.brokers, config.*ConsumerGroup). The chart refuses to render without them, so this usually means raw manifests or extraEnv.
cmd/mcp exits for KAFKA_BROKERS although it uses no KafkaBy design: its writes enqueue outbox rows a relay must drain, and /readyz reports the broker.The error text says so.Set kafka.brokers for the MCP Deployment.
Boot loops on retrying ... run migrations then exitsPostgres unreachable, wrong DSN, or the migrations connection goes through a pooler that cannot hold the advisory lock.retrying log lines show op and err; the final error names DATABASE_URL.Fix reachability or set MIGRATIONS_DATABASE_URL to a direct session-mode connection (chart: database.migrationsExistingSecretKey).
Pod is Running but never Ready, /readyz 503 dependency-unavailablePostgres or Kafka does not answer within 2 s (verdict cached 3 s).The problem detail reads not ready: postgres, kafka; log readiness: dependency is not ready.Restore the dependency; nothing needs a restart.
/readyz 503 {"status":"not_ready"} with no failing listThe pod is draining after SIGTERM.A shutdown: readiness flipped log line.Expected during a rollout.
Pod killed during shutdownterminationGracePeriodSeconds (40) is shorter than the worst-case await bounds (consumers 30 s, relay 30 s).Exit status 137 and a missing "stopped" sequence.Raise terminationGracePeriodSeconds; the chart test refuses values below 40.
cmd/api exits non-zero some time after bootThe relay or the consumers returned on their own (a reader failure), by design so the orchestrator restarts it.Log the outbox relay stopped unexpectedly or the kafka consumers stopped unexpectedly.Read the wrapped error; fix Kafka or Postgres.
Helm render failsdatabase.url/existingSecret, kafka.brokers or a consumer group is empty, kafka.enabled=false, or the sweep retry budget exceeds activeDeadlineSeconds.The fail message names the value.Set the value.

Requests refused​

Errors are application/problem+json; the type is https://errors.dock-scheduling.warehouse-systems.dev/<slug>.

SymptomCauseCheckFix
400 idempotency-key-required on a POSTEvery POST needs Idempotency-Key (1-128 printable ASCII).The request headers.Send a fresh UUID per logical request; reuse it only to retry.
409 idempotency-key-reusedThe same key was sent with a different method, path or body.Compare the two requests.Use a new key.
409 door-double-bookedAnother BOOKED or CHECKED_IN appointment overlaps the window on that door (half-open [start, end)).GET /doors/{doorCode}/availability for the window.Pick a free window or another door.
409 door-unavailableThe window is outside the door's operating hours or inside a closure.GET /sites/{siteId}/dock-calendar (hours, closures).Move the window, lift the closure, or declare hours.
422 unknown-doorThe door is not a known, active dock slot in the local copy.The facility consumer: log fact consumed for SlotRegistered; unknown_door in dock_scheduling_ignored_facts_total.Wait for or fix the facility feed; a decommissioned door is unknown.
422 door-flow-mismatchDirection does not match the door's dock flow.The door's dockFlow.Use an inbound or outbound door accordingly.
422 unknown-asn / 409 asn-already-scheduledThe ASN is not in the local copy (or cancelled), or already on an active appointment.The ASN consumer on warehouse.inbound-receiving.events.Wait for the ASN fact; cancel the other appointment first.
422 missing-outbound-refAn OUTBOUND booking names neither a known cptId nor shipmentRefs.The cutoff copy (cutoff_schedules, cutoffs) fed from warehouse.process-path-management.events.Pass shipmentRefs or wait for the schedule.
422 window-in-past, invalid-windowStart before now, end not after start, off the site's slot grid, or longer than max_window_minutes (default 240).The calendar settings.Correct the window.
409 concurrent-update / 412 precondition-failedAnother writer changed the appointment (version), or If-Match carries a stale ETag.GET /appointments/{id}: ETag W/"<version>".Re-fetch and retry.
409 illegal-transitionThe command is not legal in the current state (for example reschedule of a CHECKED_IN appointment).The appointment's state.See the use cases.
409 no-show-too-earlyThe no-show grace has not passed.no_show_grace_minutes in the settings (default 60).Wait.
409 hours-conflict-with-appointments / closure-conflicts-with-appointmentsNew hours or a closure would strand active appointments; the detail lists their ids.The listed appointments.Reschedule or cancel them first.
400 unknown-query-parameterAn unsupported query parameter (rejected, never ignored).The OpenAPI spec.Remove it.
500 internal-errorAn unmapped error; the response is generic on purpose.Log request failed with error, method, path.Fix the cause named in the log.

Events not leaving (producer side)​

SymptomCauseCheckFix
Bookings succeed but downstream sees nothingThe relay is not draining: broker down, no relay running (cmd/mcp alone starts none), or rows past the attempt cap.SELECT count(*), min(created_at) FROM outbox; growing; outbox relay pass failed logs.Restore Kafka; run the api or enable relay.enabled.
One row stuck, others flowThe row reached OUTBOX_MAX_ATTEMPTS (log row reached the attempt cap).SELECT id, event_id, aggreg_type, attempts FROM outbox WHERE attempts >= 20;Fix the cause, then UPDATE outbox SET attempts = 0, next_attempt_at = now() WHERE id = <id>;.
Poison rows on warehouse.dock-scheduling.events.dlqA payload that is not the publisher's envelope (event type outbox-poison).Read the DLQ message.Fix the producer bug; replay by hand.
Consumers see the same event twiceAt-least-once delivery.Same CloudEvents id.Dedupe on id (this service does).

Facts not arriving (consumer side)​

SymptomCauseCheckFix
No door/ASN/cutoff data after first deployA new consumer group starts at the first offset and replays; the topic may be empty, the broker unreachable, or the group id wrong.kafka reader error; retrying, fact consumed lines; group ids.Check KAFKA_BROKERS and the group variables.
Partition stuck, repeated handling failed; retrying the same messageA transient failure (Postgres, lost commit) retried forever by design.error, partition, offset, attempt.Fix the dependency; it resumes.
Messages appearing on <topic>.dlqHandled type that can never apply.Headers x-dlq-cause, x-dlq-source-topic.Fix the producer; replay.
Arrival or release not appliedThe fact cites an unknown or terminal appointment, or the wrong site.dock_scheduling_ignored_facts_total{reason} (unknown_appointment, terminal_appointment, site_mismatch).Expected for stale facts; otherwise check the yard feed.

No-show sweep​

SymptomCauseCheckFix
Appointments never become NO_SHOWsweeps.enabled=false, the CronJob fails, or the appointment is still inside window_end + no_show_grace.kubectl get jobs; the job's log sweep: ....Enable the CronJob; wait out the grace.
Job fails with exit 1The API answered 4xx (other than 429; not retried) or kept failing after SWEEP_MAX_ATTEMPTS.sweep: failed; exiting non-zero so the Job fails fast with url.Check SWEEP_URL (/no-show-sweeps on the api Service) and the API's health.
Job exits 2Invalid configuration (SWEEP_URL empty, bad duration or attempts).sweep: invalid configuration.Fix the variable.
Job pod never completesThe Istio sidecar kept running.SIDECAR_QUIT_URL.Leave the default in a mesh; set empty outside one.

Analytics​

SymptomCauseCheckFix
GET /reports/freshness shows a large lagSeconds, or asOf nullThe projector is down, behind, or has not seen an event.analytics-projector readiness and logs; warehouse.dock-scheduling.analytics consumer group lag.Restore the projector; a new group replays from the start.
Reports return emptyanalytics.enabled=false, or the reports pool points at an empty database.The chart value; ANALYTICS_DATABASE_URL.Enable analytics; wait for the projection.
Projector exits at bootAnalytical database unreachable or the DSN is not direct (it runs migrations).run analytics migrations retry logs.Use a direct DSN with the projector's read-write role.

MCP​

SymptomCauseCheckFix
An MCP booking is accepted but events never publishNo relay is running (the MCP binary starts none).The outbox backlog query above.Run the api or cmd/relay.
Replayed write returns the first answerThe same idempotencyKey and arguments.replayed: true in the answer and log mcp write.Use a new key for a new action.