Skip to main content

Troubleshooting

Symptom, cause, check, fix, built from the failure modes visible in the code. Log messages and problem slugs are the literal strings in cmd/, internal/adapters/inbound/http/problems.go and internal/adapters/outbound/outbox/relay.go. The table names are in the runbook. This service has no outbound HTTP, MCP or A2A client and consumes no Kafka topic, so there is no circuit breaker and no consumer lag to chase; the dependencies that can fail are Postgres and, for the relay and /readyz, Kafka.

Boot​

SymptomLikely causeCheckFix
cmd/api exits 1 at once: missing required environment variable: DATABASE_URLDATABASE_URL unset or empty. There is no in-memory runtime to fall back toThe ERROR line service exited with error or the pod's kubectl logsSet it (Configuration)
cmd/api exits 1: missing required environment variable: KAFKA_BROKERS (comma-separated host:port list)KAFKA_BROKERS unset, or only blanks and commasPod envSet a host:port list. The api needs Kafka for the relay and /readyz; cmd/mcp and cmd/a2a do not
cmd/mcp or cmd/a2a exits 1: DATABASE_URL is required: this context runs on real PostgresEmpty DATABASE_URLPod envSet it
cmd/a2a exits 1: A2A_AGENT_URL is required: the absolute http(s) URL clients dial, advertised on the Agent Card or A2A_AGENT_URL must be an absolute http(s) URL with a host, got "..."The Agent Card must advertise a dialable URL, so there is no default; checked before anything else startsPod envGive an absolute http(s) URL with a host. In the chart leave a2a.agentUrl empty to get the in-cluster Service DNS on port 8093
Exits 1 after about 15 s: run migrations (after 5 attempts): ... or ping postgres (after 5 attempts): ...Postgres unreachable, wrong DSN, or a migration that fails. The retry is 5 attempts with 1, 2, 4 and 8 s waits (internal/bootretry)WARN lines retrying carry op, attempt and err; try psql from the same networkFix the DSN or network. Fail-closed on purpose: the service never boots without its database
Migrations hang, or fail on the advisory lockDATABASE_URL goes through a transaction-pooling PgBouncer and MIGRATIONS_DATABASE_URL is not set. golang-migrate takes a session advisory lockIs the DSN a pooler address?Set MIGRATIONS_DATABASE_URL to a direct Postgres DSN
Every boot fails the same way after one crashed migrationschema_migrations.dirty = true: golang-migrate refuses to continueSELECT version, dirty FROM schema_migrationsRepair the schema by hand, then force the version with golang-migrate. Back up first
A warning invalid OUTBOX_RELAY_INTERVAL; using the default, invalid OUTBOX_MAX_ATTEMPTS; using the default or ignoring invalid SHUTDOWN_DRAIN_DELAYMalformed or out-of-range value. The service starts with the default instead of failingThe WARN line carries value and defaultFix the value. A typo never removes the attempt cap: it falls back to 20
cmd/api exits non-zero later with outbox-relay stopped unexpectedly: exiting so the orchestrator restarts the serviceThe relay goroutine returned by itselfLogs just before the exitKubernetes restarts the pod. Persistent exits point at the cause logged before it
Telemetry shows nothing in Jaeger or Prometheus but the service worksThe Collector is unreachable. Export never blocks, so the only symptom is missing dataLOG_LEVEL=debug shows opentelemetry error lines; check OTEL_EXPORTER_OTLP_ENDPOINT in the telemetry configured boot linePoint the variable at the Collector

Readiness and probes​

SymptomLikely causeCheckFix
GET /readyz is 503 with body {"status":"not_ready"}The pod is shutting down: the drain gate flips on SIGINT or SIGTERMIs the pod terminating?Nothing to fix; a new pod takes over
GET /readyz is 503 application/problem+json, type dependency-unavailable, detail not ready: kafka (or postgres, or postgres, kafka)No broker answered a topic-less metadata request, or the Postgres ping failed. The verdict is cached 3 s and a round is bounded to 2 sWARN readiness: dependency is not ready has dependency and errorRestore the broker or database; the process stays up and recovers by itself. A missing topic never causes this: the check names no topic
/healthz is 200 but requests fail with 500A single query failing for another reason (statement timeout, constraint, bug); /readyz only proves Postgres answers a pingERROR request failed carries the real error (the response says only an unexpected error occurred)Fix the cause shown in the log
Statements fail with canceling statement due to statement timeoutThe pool sets statement_timeout = 5s on every connection and a pool of at most 10 connections per process (postgres/pool.go)request failed lines; slow queries in PostgresInvestigate the query. Both limits are compiled in
cmd/mcp or cmd/a2a answers /healthz but a tool or skill failsThese binaries have no /readyz; they only need Postgresmcp tool failed with an unexpected error or a2a skill failed in the logsFix Postgres connectivity

The outbox and Kafka​

SymptomLikely causeCheckFix
Writes succeed but no event reaches the topic; outbox_events.published_at stays NULLThe broker is unreachable. Writes are accepted and queued by designERROR outbox relay pass failed each pass with the cause; /readyz names kafka; SELECT id, event_type, attempts, last_error FROM outbox_events WHERE published_at IS NULL ORDER BY idRestore the broker. Rows drain in id order
ERROR outbox relay: row reached the attempt cap and is excluded from future claims; re-arm it with attempts = 0 after fixing the causeA poison row, or an outage longer than OUTBOX_MAX_ATTEMPTS passes (default 20, one pass per OUTBOX_RELAY_INTERVAL, default 1 s). Later rows, the same key included, overtake the capped oneSELECT id, event_type, attempts, last_error FROM outbox_events WHERE published_at IS NULL AND attempts >= 20Fix the cause, then UPDATE outbox_events SET attempts = 0 WHERE id = <id>. Consumers see the event late, out of order, with its original CloudEvents id. OUTBOX_MAX_ATTEMPTS=0 removes the cap and lets a poison row block
Downstream contexts report a stale node, lane or service areaThe relay is stalled or rows hit the capoutbox relay running at boot; backlog query aboveRestore the relay; re-arm capped rows
A consumer sees the same event twiceAt-least-once delivery after a crash between the send and the published_at update. The CloudEvents id is stableCompare the idConsumers deduplicate on id. Nothing to fix here
Topic retailnetwork.node-topology.events does not exist yetNothing was published. The first write creates it (the relay's writer allows auto-creation)kafka-topics.sh --listNormal on a fresh broker. On a broker with auto-creation disabled, create the topic
Pod restart loses nothingExpected: events are committed with the aggregateoutbox_events rows survivenone

Idempotency​

SymptomLikely causeCheckFix
400 idempotency-key-requiredA POST, PUT or :action call without Idempotency-Key. Every state-changing route needs one; there is no unkeyed modeThe request headersSend a unique key per logical request
400 idempotency-key-invalidKey longer than 128 characters or not printable ASCIIThe keyUse 1 to 128 printable ASCII characters
409 idempotency-key-reusedThe same key with a different method, path or body (the key is global); or the key expired while the request was in flightCompare the two requestsUse a new key, or resend the original request to get its stored answer
A rejected request keeps answering the same 4xxA 2xx and a refusal that is a function of the request alone (for example validation-failed, vendor-node-code-taken, region-code-taken) are stored for 24 h and replayed byte for byte with header Idempotency-Replayed: true. A 5xx is never stored, and neither is a refusal that depends on state another request can change (not-found, illegal-transition, concurrent-update, incomplete-operational-profile, serving-station-not-allowed, lane-endpoint-not-active, duplicate-lane, not-a-delivery-station, handoff-node-not-usable, unknown-region): the retry under the same key runs again (ADR 0020)The response headerFix the request and send it with a new key
A retry after a 500 does the work againExpected: a 5xx rolls everything back and is not stored, so the same key can retrynonenone

REST problem types​

Every error is application/problem+json with type (the slug), title, status, detail and instance (the request path). The catalogue is problemCatalogue in internal/adapters/inbound/http/problems.go.

StatusSlugWhenWhat to do
400malformed-request-bodyNot valid JSON for the operation: unknown field, wrong type, trailing data, empty body, or a NUL characterFix the body against apis/openapi.yaml
400malformed-request-queryA NUL character in the query stringRemove it
413request-body-too-largeBody over 64 KiBSend less
400idempotency-key-required, idempotency-key-invalidSee Idempotency above
404not-foundUnknown id, unassigned prefix, or no route matchesCheck the id; GET /nodes/{nodeId} before acting
405method-not-allowedWrong verb on a known pathCheck the method
409illegal-transitionA lifecycle move the state machine refuses, for example activating an ACTIVE node, suspending a PROPOSED one, or closing a CLOSED laneGET the aggregate and read its status
409concurrent-updateTwo writers raced on one aggregate and the version guard of the loser failedRe-read and retry
409vendor-node-code-takenThe vendor already registered a node with this vendorNodeCodeUse the existing node
409stale-profile-revisionprofileRevision is not above the node's current oneGET the node and send current + 1
409incomplete-operational-profileActivating a FULFILLMENT_CENTER whose current profile has no cutoff or a handling time of zero, or declaring such a revision on an ACTIVE fulfilment centreDeclare a complete revision, then activate
409node-retiredAny transition or profile declaration on a RETIRED node, which is terminalRegister a new node
409lane-endpoint-not-activeEither end of the lane is not an ACTIVE nodeActivate the node first
409duplicate-laneAn OPEN lane with the same origin, destination and mode existsReuse it
409not-a-delivery-stationThe target of a service-area assignment is not an ACTIVE delivery stationActivate the station or pick another
409stale-assignment-versionassignmentVersion is not above the current one for the prefixResolve the prefix and send current + 1
409region-code-takenA region with this code existsUse the existing region
409idempotency-key-reusedSee Idempotency above
422operator-not-allowed-for-node-typeParcel nodes (sortation centre, delivery station, air hub) must be NETWORK-operated; fulfilment centre, inbound cross-dock and returns centre must be VENDOR-operatedFix operator
422subtype-not-allowedA subtype on anything but a fulfilment centreDrop it
422cutoff-outside-operating-hoursA cutoff falls outside the operating hours of its dayFix the profile
422sort-dwell-not-allowedsortDwellMinutes on a node that does not sortDrop it
422inbound-limits-not-allowedinbound limits on a node type without the INBOUND capability (only fulfilment centres and inbound cross-docks receive inbound)Drop inbound
422lane-loopOrigin and destination are the same nodePick two nodes
422lane-type-pair-not-allowedThis pair of node types may not be connectedSee the allowed pairs in use cases
422unknown-regionregionId does not existDefine the region first
422validation-failedAny value-object rule: bad enumeration value, malformed timezone or postal code, empty required fieldThe detail text names the field
500internal-errorUnmapped error or handler panic; detail is always an unexpected error occurredRead the request failed or panic in handler log line
503dependency-unavailableGET /readyz onlySee Readiness above

MCP tools return the same vocabulary as text: not-found: ..., validation-failed: ... or internal-error: an unexpected internal error occurred in an isError tool result. A2A skills answer the same slugs as problem objects.