Skip to main content

Troubleshooting

Symptom, cause, check, fix, from the failure modes the code actually has. Log messages are quoted exactly as slog writes them; see Observability for the full list and Runbook for the procedures.

Boot​

SymptomCauseCheckFix
Process exits with status 1 and service exited with error, DATABASE_URL is required: this context runs on real Postgres, there is no in-memory mode (real output)a mandatory variable is missing; cmd/api reports one per start, in this order: DATABASE_URL, KAFKA_BROKERS, DELIVERY_PROMISE_URL, then DELIVERY_PROMISE_CONSUMER_GROUP, ORDER_SOURCING_CONSUMER_GROUP, SHIPPING_CONSUMER_GROUPthe message names the variable; kubectl logs deploy/customer-ordering --previousset the variable (chart: database.*, kafka.brokers, config.deliveryPromiseUrl, config.*ConsumerGroup); the chart itself refuses to render without them
DELIVERY_PROMISE_TIMEOUT: "soon" is not a positive Go durationunparsable or non-positive duration (a boot error, unlike the relay knobs)the quoted valueuse 5s, 750ms
cmd/a2a exits with A2A_AGENT_URL is required... or A2A_AGENT_URL="..." is not an absolute http(s) URLthe Agent Card must advertise the URL clients dialthe message; chart a2a.agentUrlset an absolute http(s) URL ending where JSON-RPC is served, for example http://customer-ordering-a2a.<ns>.svc.cluster.local:8093/
retrying WARN lines (op = run migrations or ping postgres), then exitfirst dial of an injected pod reset, or Postgres/PgBouncer unreachable; the retry is boundedop, attempt, errrestore the database; the last error is returned on exhaustion and the pod restarts
Boot blocks or fails in migrations behind PgBouncergolang-migrate's session advisory lock does not survive transaction poolingMIGRATIONS_DATABASE_URL equals the pooled DSNgive MIGRATIONS_DATABASE_URL a direct DSN (chart: database.migrationsExistingSecretKey)
Warnings invalid OUTBOX_RELAY_INTERVAL; using the default, invalid OUTBOX_MAX_ATTEMPTS; using the default, ignoring invalid SHUTDOWN_DRAIN_DELAYa typo in an optional knob; the default is used, so a typo never removes the attempt capthe value fieldfix the value
service exited with error: <consumer> stopped unexpectedly: exiting so the orchestrator restarts the servicethe relay or a consumer returned on its own (a lost broker, a failed reader)the ERROR line before it (consumer stopped, outbox relay stopped)restore Kafka; the restart is by design

Readiness and dependencies​

SymptomCauseCheckFix
/readyz 503 dependency-unavailable, /healthz 200Postgres ping or the Kafka broker metadata request failed (detail names postgres or kafka, never the cause)WARN log readiness: dependency is not ready has dependency and error; the verdict is cached 3 srestore the dependency; it recovers within 3 s. Kafka down: writes are still accepted, events queue in outbox_events
/readyz 503 {"status":"not_ready"}the pod is draining after SIGTERMshutdown: readiness flipped to not-ready in the logexpected during rollout
Checkout answers 503 delivery-promise-unavailablethe synchronous call to delivery-promise failed or timed out (DELIVERY_PROMISE_TIMEOUT, default 5 s)curl $DELIVERY_PROMISE_URL/... from the pod; ordering_orders_placed_total{reason="delivery-promise-unavailable"}restore delivery-promise or correct DELIVERY_PROMISE_URL; nothing is placed
Checkout answers 409 offer-not-quotable, promise-capacity-exhausted or book-closeddelivery-promise refused: the offer expired or its capacity is gone, or the book is closedthe reason attribute of ordering.orders.placedthe caller asks for new offers and retries with a new Idempotency-Key
Checkout failed after some groups were confirmedthe later confirm failed; the earlier promises of the same checkout are cancelled again (ADR 0002 A14)log cancelled a confirmed promise of a failed checkout; if compensating cancel of a confirmed promise failed; the hold stays at delivery-promise, the cancel is queued (enqueued failed compensating cancels for retry) and compensation_cancels has a row with released_at IS NULLwait for the compensation worker (Runbook); release the promise in delivery-promise by hand only when the row reached COMPENSATION_MAX_ATTEMPTS or the log says enqueueing failed compensating cancels for retry failed

REST answers​

SymptomCauseCheckFix
400 idempotency-key-required / idempotency-key-invalida POST without the header (required), or a key that is not 1 to 128 printable ASCII characters (invalid)the request headerssend a client-generated UUID per logical request
409 idempotency-key-reused right after a 400 or on another routea success and a FINAL or OUTCOME refusal (a malformed body, shopper-exists, offer-not-quotable, ...) are stored under the global key for 24 h; a corrected body (or another method or path) with the same key then counts as a different request (reproduced in the Quickstart). A RETRYABLE refusal (concurrent-update, not-found, validation-failed, ...) is NOT stored: the key is free and the same key may be retried, with the same or another body (ADR 0019). A client bug: do not retry blindlySELECT * FROM idempotency_keys WHERE key = '...'use a new key after a stored refusal; retry the same key after a RETRYABLE one; keep the body byte-stable per logical request
400 malformed-request, detail json: unknown field "x"unknown field, trailing data, empty or invalid JSON (the decoder is strict)the detail names the fieldsend only the fields of the OpenAPI schema
422 validation-faileda domain or request validation failed (bad ship-to country code, empty cancel reason, missing shopperId)the detailfix the input; GET /orders needs shopperId
400 invalid-limit, invalid-cursor, unknown-query-parameterlimit is not an integer from 1 to 500, cursor is not a token a previous page returned, or the query carries a parameter the list does not declare (the retired after, offset, nextToken)the detailsend limit 1 to 500 and the nextCursor of the previous page as cursor
422 line-without-promise, group-spans-nodes, promise-destination-mismatchthe checkout groups do not cover each line exactly once, a group needs more than one node, or a promise was made for another destinationthe detailrebuild the checkout request from fresh offers
404 not-foundunknown order or shopper (also on GET /orders?shopperId= for an unknown shopper)the idcheck the id
409 shopper-existsthe lower-cased e-mail is registeredGET /shoppers?email=use the existing shopper
422 too-many-addressesa shopper holds at most 20 saved addressesGET /shoppers/{id}fix: the API has no delete route for saved addresses, so the limit cannot be freed through it
409 cancel-after-lockevery shipment group is locked; cancellation is now a returnthe order's group statusesnot cancellable
409 concurrent-updateoptimistic version guard lost a racerepeatedretry with the same key; the use case already retried once (2 attempts)
409 illegal-transition, status-regressionthe order does not allow the change in its stateGET /orders/{id}none
500 internal-erroranything else (database error, bug)ERROR http request line with the request_id and trace_idfollow the trace; the response never carries the cause
GET /orders/{id}/ship-to header Cache-Control: no-store and an addressby design: the only order route returning the address; restricted to label printingdo not cache or log it

Outbox and events​

SymptomCauseCheckFix
outbox_events rows with published_at IS NULL pile up; outbox relay pass failed repeatsKafka unreachable or the topic refused the writeSELECT count(*) FROM outbox_events WHERE published_at IS NULL; and the last_error columnrestore Kafka; the relay drains in id order by itself
ERROR outbox relay: row reached the attempt cap and is excluded from future claims; re-arm it with attempts = 0 after fixing the cause; later events overtake the parked onethe row failed OUTBOX_MAX_ATTEMPTS (20) timesSELECT id, event_type, attempts, last_error FROM outbox_events WHERE published_at IS NULL AND attempts >= 20;fix the cause, then UPDATE outbox_events SET attempts = 0 WHERE id = <id>;
One failed first write to retailnetwork.customer-ordering.events with an unknown-topic errorthe topic does not exist yet; the broker auto-creates it on the first writethe relay retries with the same event idnone
A consumer logs <consumer> handling failed; retrying the same messagea transient failure (database, contention with a sibling group on the same order); capped backoff 200 ms to 5 sattempt / max_attempts (5)after 5 attempts the message goes to <topic>.dlq
Messages in <consumed topic>.dlqthe handler gave up (5 attempts) or the payload can never be applied; the x-dlq-error header has the causebroker tooling on the .dlq topicfix the cause, re-publish the original to the source topic
WARN skipping a message that is not a valid CloudEventa producer wrote a record that is not a CloudEventtopicfix the producer
INFO consumed event skipped, reason: order ...: not foundan event about an order this database does not hold: normal when a fresh group replays history, or in a shared kind cluster after a database reseteventId, typenone; if it appears for real orders, check that the consumer's database is the one cmd/api writes
An order's status or tracking does not movethe producing context has not published yet, the consumer is lagging, or the event would move the status backwards (skipped by design, ADR 0002 A7)processed_events for the event id; broker tooling for the group lagwait for the producer; the service exports no lag metric
A new local run re-reads every old eventa fresh consumer group id replays each topic from the first offsetconsumer running log line shows group_idexpected
Silence on a consumed topic, or WARN <consumer> broker connection stalled or lost; fetching again after the backoffthe topic has no messages yet (its producer never wrote), or the broker connection dropped and is being re-dialledbroker tooling; the readers dial lazily, so a broker outage never blocks bootcheck the producer context and the broker

MCP and A2A​

SymptomCauseCheckFix
MCP client gets a session or 400 error on tools/listStreamable HTTP needs initialize first and the Mcp-Session-Id header afterwards, with Accept: application/json, text/event-streamMCP toolsfollow the handshake
MCP tools/call returns isError: true with not-found: order ... not foundunknown or malformed order idthe textcheck the id
A2A returns JSON-RPC error -32009 this version is not supported: requested "0.3", served "1.0"the request did not carry A2A-Version: 1.0the headersend it
A2A reply carries a problem part with 404no order exists with orderId ..., answered in-band, never as a JSON-RPC errorthe data partcheck the id
Agent Card advertises a wrong URLA2A_AGENT_URL is wrong for the network the client is onGET /.well-known/agent-card.json, supportedInterfaces[0].urlcorrect A2A_AGENT_URL (chart a2a.agentUrl)

Local development​

SymptomCauseFix
make integration fails to start containersDocker is not running; the integration tests boot their own Postgres and Kafka with testcontainers and have no DATABASE_URL gatestart Docker
make lint says golangci-lint is not installedthe pinned version is not on PATHgo install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.14.0
git push fails with "parallel golangci-lint is running"another lint run holds the lock; the pre-push hook runs make checkwait about a minute and push again
npm run build in docs/ fails on api-reference/rest/sidebarthe generated REST pages are missingnpm run gen-api-docs