Skip to main content

Troubleshooting

Each entry follows symptom, cause, check, fix. The checks use psql against the service database, kubectl logs and the log messages listed on Observability. The procedures behind them are on the Runbook.

Boot and readiness​

SymptomCauseCheckFix
cmd/api exits at once with DATABASE_URL is required: this context runs on real Postgres, there is no in-memory modeThe variable is unset or empty (cmd/api/config.go)First log line of kubectl logs --previousSet database.url or database.existingSecret in the chart, or export DATABASE_URL
KAFKA_BROKERS is required: this context runs on real Kafka (...)Empty list (blank entries are dropped)SameSet kafka.brokers (host:port,host:port)
NODE_TOPOLOGY_CONSUMER_GROUP is required: every consumer runs under a stable, service-prefixed consumer group (or the order-sourcing / shipping variant)One of the three consumer-group variables is blankThe message names the variableSet config.nodeTopologyConsumerGroup, config.orderSourcingConsumerGroup, config.shippingAndTrackingConsumerGroup; the chart refuses to render without them
OUTBOX_RELAY_INTERVAL="abc" is neither a Go duration nor a number of seconds, ... must not be negative, PACKAGES_PER_ORDER="0" must be an integer >= 1, OUTBOX_MAX_ATTEMPTS=... must be an integer >= 0Invalid duration or integerThe message names variable and valueUse 500ms, 2s, 5; see Configuration
cmd/a2a exits with A2A_AGENT_URL is required: the Agent Card must advertise the absolute URL clients dial or A2A_AGENT_URL="..." is not an absolute http(s) URLMissing or malformed card URL; the error is reported together with a missing DATABASE_URLBoot logSet a2a.agentUrl (empty in the chart means the in-cluster Service DNS) or A2A_AGENT_URL=http://host:8093/
Pod restarts during boot with run migrations failed; retrying (mcp, a2a) or migrations (MIGRATIONS_DATABASE_URL / DATABASE_URL): ... (api)Postgres not reachable for the ~30 s retry window, a wrong direct DSN, or MIGRATIONS_DATABASE_URL pointing at a transaction-pooling proxy (golang-migrate's advisory lock needs a session)kubectl logs; try psql "$MIGRATIONS_DATABASE_URL"Fix the Secret key MIGRATIONS_DATABASE_URL (a direct, session-mode DSN); the startup probe allows 2 s x 45
/readyz answers 503 application/problem+json of type dependency-unavailable naming postgres or kafkaA dependency failed its probe (verdict cached 3 s, bounded 2 s)WARN readiness: dependency is not ready with dependency and errorRestore the dependency. /healthz stays 200 on purpose: do not restart the pod for this
/readyz 503 {"status":"not_ready"}The pod is draining after SIGTERMLog shutting downExpected during rollout
Process exits with worker stopped on its own / service exited with error naming ... consumer and failed to dialA consumer could not connect to Kafka at all (connection refused is fatal for the worker; only stalled or reset connections are retried, up to 10 times)Log line; KAFKA_BROKERS value and reachability from the podFix the broker address or bring Kafka up before the pod; Kubernetes restarts until it succeeds
bind: address already in use on startHTTP_ADDR, MCP_ADDR or A2A_ADDR collides with another processLog service exited with errorChoose another address

Events and data​

SymptomCauseCheckFix
A downstream context misses an event that later events of the same aggregate overtookThe outbox row reached OUTBOX_MAX_ATTEMPTS (20) failures and is excluded from claimsERROR outbox relay: row reached the attempt cap ...; SELECT id, topic, event_type, attempts, last_error FROM outbox_events WHERE published_at IS NULL ORDER BY id;Fix the cause (broker, topic permissions), then UPDATE outbox_events SET attempts = 0 WHERE id = <id>;
Events accumulate with published_at IS NULL and attempts risingKafka unreachable or the topic cannot be createdERROR outbox relay pass failed each pass; /readyz names kafkaRestore Kafka; no re-arm needed below the cap. The first publish to a new topic may show attempts = 2 while it auto-creates: normal
Writes succeed but nothing is publishedcmd/api is not running (only cmd/mcp/cmd/a2a are up) or the relay diedIs the api Deployment healthy; worker stopped on its ownRun cmd/api; the MCP and A2A binaries never relay
No departures appear after defining a lane scheduleDepartures are produced by the horizon roll (boot, then every GENERATE_INTERVAL, default 1 h), not by the POST; or the lane is not OPEN / the origin and destination node views are missingLog horizon roll with scheduled/failed; SELECT * FROM lane_views WHERE id = '<laneId>';, SELECT id, state FROM lane_schedules;Wait for the next roll or restart cmd/api (it rolls at boot); make sure node-topology's NodeRegistered and LaneOpened reached the topic and the consumer
POST /lane-schedules answers 404 not-foundThe lane is unknown: no LaneOpened was consumed yetSELECT * FROM lane_views; and the node-topology consumer logsPublish or wait for the node-topology events; see Integration
Pickup departures missing for a vendor nodeThe node is not an ACTIVE vendor fulfillment centre with a profile and cutoffs, or has no default outbound laneSELECT * FROM node_views WHERE id = '<nodeId>';Check the node-topology events (NodeActivated, NodeOperationalProfileDeclared)
ERROR <consumer> handling failed; retrying the same message repeating, then a message on <topic>.dlqThe handler error persisted for 5 attempts, or the payload can never be appliedConsumer log with partition, offset; read the .dlq message headers x-dlq-error, x-dlq-source-topic, x-dlq-source-offsetFix the cause and produce the DLQ message value back to the source topic: replay is idempotent through processed_events
WARN skipping a message that is not a valid CloudEvent / skipping an event that can never be appliedThe producer sent a non-CloudEvents 1.0 message or a payload the domain refusesLog line (type, event_id)Fix the producer; nothing to do here, the offset is committed
A booking moved to another pickup (BookingMoved) or failed (BookingFailed)The locked pickup departure is unknown, closed, cancelled or fullEvents on retailnetwork.linehaul-transportation.eventsBy design (ADR 0002 A14); add capacity with PUT /departures/{departureId}/capacity
Consumer topic has zero lag and no dataThe producer has not written yet; topics are auto-created by the first writerKafka topic listNormal early state

REST problem types​

All errors are RFC 9457 application/problem+json with type = https://retailnetwork.example/problems/<slug> (internal/adapters/inbound/http/errors.go).

StatusSlugCauseFix
400malformed-requestBody is not valid JSON, has unknown fields or could not be readSend the documented body
400idempotency-key-requiredA POST without the Idempotency-Key headerSend a unique key per logical request
400idempotency-key-invalidKey not 1 to 128 printable ASCII charactersSend a UUID
404not-foundUnknown departure, load, lane or scheduleCheck the id; for a lane, see above
409illegal-transitionThe state does not allow the command (for example POST /loads/{loadId}/dispatches on an OPEN load, which must be CLOSED first)Read the resource state; follow open, close, dispatch, receive
409concurrent-updateAnother request modified the aggregate (version guard)Re-fetch and retry
409departure-fullThe departure has no remaining capacitychange-capacity or use another departure
409departure-closedA booking after cutoffAt, or the departure is no longer SCHEDULEDPick a later departure
409lane-closedA departure was being scheduled on a lane that is not OPENWait for node-topology's LaneOpened
409package-already-loadedThe tracking number is already on an OPEN or CLOSED loadUse that load; the package can be loaded again once that load has departed
409load-over-capacityAdding the package exceeds the departure capacityRaise capacity or open another load
409load-already-existsThe departure already has a loadUse that load
413request-body-too-largeBody above the limitSend less data (a schedule has at most 100 slots)
422validation-failedA field is invalid (bad time, unknown mode)Fix the field named in detail
422invalid-departure-timesdepartsLocalTime is before cutoffLocalTimeDepart at or after the cutoff
422overlapping-slotsTwo slots overlap on the same weekdayRemove the overlap
409idempotency-key-reusedSame key, different method, path or bodyUse a new key for a different request
400invalid-limit, invalid-cursor, unknown-query-parameterGET /departures with a limit outside 1..500, a cursor that was not issued by the service, or a retired paging parameter (after, offset, nextToken)Follow nextCursor as returned; send only the declared parameters
500internal-errorUnexpected failure; 5xx are never stored for replayLog line with request_id and trace_id; retry with the same key

An equal request with the same key replays the first stored answer and adds Idempotency-Replayed: true; keys live 24 h. A 2xx and a refusal that is a function of the request alone (malformed-request, request-body-too-large, invalid-departure-times, overlapping-slots, validation-failed, load-over-capacity, load-already-exists) are stored: fix the request and send it with a new key. A refusal that depends on state another request can change (concurrent-update, departure-closed, departure-full, illegal-transition, lane-closed, not-found, package-already-loaded) is not stored (ADR 0015): the key is released, so the same key can be sent again once the state allows it, and a different body under a released key is a new request. A 5xx is never stored either.

MCP and A2A​

SymptomCauseFix
MCP tools/call fails with not-found or validation-failed prefixUnknown departure id; limit outside 1..1000, from after to, or a time that is not RFC 3339Fix the arguments
MCP request without a session id is rejectedStreamable HTTP needs initialize first and the Mcp-Session-Id header afterwards; send Accept: application/json, text/event-streamSee Quickstart
A2A answers 400 unknown-skill, malformed-request or invalid-argument inside the messageThe data part is not {"skill": "...", "arguments": {...}}, or has unknown argumentsUse list_departures or get_departure with documented arguments
A2A client dials the wrong hostThe Agent Card advertises A2A_AGENT_URLSet the URL clients can reach
MCP/A2A pod is up but data is stale or emptyThey read the same database as cmd/api; nothing is written by themCheck cmd/api (consumers, horizon roll)

Logging in​

There is nothing to log in to: REST, MCP and A2A are unauthenticated and rely on the cluster network boundary. A 401 or 403 therefore comes from infrastructure in front of the service, not from this code.