Skip to main content

Troubleshooting

Each entry is a symptom you can observe, the cause in the code, a check you can run and the fix. For routine operations see the Runbook; for every setting see Configuration. Log lines quoted below are the real messages.

Boot​

SymptomCauseCheckFix
cmd/api exits at once with DATABASE_URL is required: this service runs on real Postgres, there is no in-memory modeThe variable is unset or empty. cmd/mcp and cmd/a2a fail the same wayPod env or Secret delivery-promise-db key DATABASE_URLSet it (chart database.url or database.existingSecret)
KAFKA_BROKERS is required: this service runs on real Kafka (outbox relay, consumer, /readyz)Unset, or only blank entries such as ,kubectl get deploy -o yaml, the KAFKA_BROKERS envSet kafka.brokers. Only cmd/api needs it; cmd/mcp and cmd/a2a never read it
DELIVERY_PROMISE_CONSUMER_GROUP is required: the consumer of the eight producing contexts always runs on a stable groupNo group configuredenvSet chart config.consumerGroup (cluster value delivery-promise-consumer). Never derive it from the pod name
EVENT_PUBLISHER=<x> is not supported: this service publishes to real KafkaAny value other than empty or kafkaenvRemove the variable or set kafka
cmd/a2a: A2A_AGENT_URL is required: an absolute http(s) URL the Agent Card advertises ... (got "...")Missing, not http(s), or no hostenvSet an absolute URL such as http://delivery-promise-a2a.<ns>.svc.cluster.local:8093/ (the chart defaults it from the release's Service DNS)
Log retrying with op="run migrations" or op="ping postgres", then exit run migrations (after 5 attempts): ...Postgres unreachable at boot (also: the first outbound dial of a pod with a fresh Istio sidecar can be reset). Backoff 1+2+4+8 spsql the DSN from the Secret; check PgBouncerRestore the database; the next restart succeeds. Transient resets recover on their own (succeeded after retry)
Migration hangs or fails at boot behind a poolerDATABASE_URL points at PgBouncer in transaction mode and MIGRATIONS_DATABASE_URL is not set, so golang-migrate's session advisory lock cannot be honoured (internal/adapters/outbound/postgres, runtime notes)Is MIGRATIONS_DATABASE_URL present in the pod env?Provide the direct (non-pooled) DSN (chart database.migrationsExistingSecretKey)
cmd/api exits later with consumer stopped unexpectedly: exiting so the orchestrator restarts the service (or outbox-relay, sweeper)A background worker returned on its own. For the consumer: a broker still unreachable after 10 consecutive fetch retries, or a non-transient fetch error (connection refused, group errors)The preceding ERROR worker stopped with worker and errorFix the cause (usually Kafka reachability); Kubernetes restarts the pod. Repeated restarts fire the container-restart alert
helm template refuses to renderThe chart guards: missing database.*, kafka.brokers, config.consumerGroup; a *_MODE or non-kafka EVENT_PUBLISHER in extraEnv; terminationGracePeriodSeconds not above SHUTDOWN_DRAIN_DELAY + 40 sThe fail message names the valueSet the missing value; raise the grace period

Probes and readiness​

SymptomCauseCheckFix
/readyz answers 503 application/problem+json, type dependency-unavailable, naming postgresThe pool ping failedcurl /readyz body names the dependency; Postgres/PgBouncer healthRestore Postgres. Verdict cache is 3 s, so recovery is quick. Writes also fail 5xx meanwhile
/readyz 503 naming kafka while writes still succeedThe metadata request to the brokers failed or exceeded the 2 s bound. Writes are not blocked: events queue in outbox_eventsKAFKA_BROKERS reachability from the podRestore Kafka; the relay then publishes the backlog in id order
/readyz 503 {"status":"not_ready"} and the process is still upDraining after SIGTERM (SHUTDOWN_DRAIN_DELAY, default 5 s)Log shutdown: readiness flipped to not-ready; waiting for traffic to drainNothing to fix: the pod is terminating
Pod Running but never Ready, /healthz 200Liveness only proves the process serves; readiness waits for Postgres and Kafkacurl /readyzSee the two rows above
Pod killed (SIGKILL) during a rollout, drain cut shortterminationGracePeriodSeconds below the sum of the shutdown boundsDefault is 60 s against drain 5 + 10 + 10 + 10 + 10Keep the chart default or more

Writes and idempotency​

SymptomCauseCheckFix
400 idempotency-key-requiredPOST /delivery-quotes, /promises, /confirmations, /cancellations and /promise-policies all require the Idempotency-Key headerRequest headersSend a unique key per logical operation
409 idempotency-key-reusedSame key with a different method, path or body. Also after a FINAL first refusal: a validation-failed, malformed-request, promise-hold-expired or promise-closed answer is stored under the key, so correcting the body and re-sending with the same key gives this error (seen on the quickstart run: a 422 validation-failed for missing lines, then idempotency-key-reused on the fixed body)Compare bodies; response lacks Idempotency-ReplayedUse a new key after changing the body. A RETRYABLE refusal (concurrent-update, promise-capacity-exhausted, not-found, ...), a 5xx and a panic store nothing: the key is free, the same key may retry and a changed body under it is a new request (ADR 0031). Keys are purged after 24 h
The same Idempotency-Key answers 409 promise-capacity-exhausted or concurrent-update again and againA RETRYABLE refusal is never replayed: each retry executes and meets the same state. No Idempotency-Replayed header is the proofGET /promise-books?nodeId=&date= for capacity; GET /promise-policies/current for the policy versionRetry later with the same key once capacity is free or the competing request has finished; nothing is stuck under the key
422 validation-failed: a group needs between 1 and 100 lines on POST /promisesThe body must repeat the offer's lines as well as offerIdGET /delivery-offers/{id} for the linesSend offerId and the same lines
409 offer-not-quotableThe offer is EXPIRED or CONSUMED (TTL is offerTtlMinutes, also capped by the pickup cutoff)GET /delivery-offers/{id} stateQuote again
409 promise-capacity-exhausted / book-closedThe witness PromiseBook has no capacity left, or its cutoff passed and the sweeper closed itGET /promise-books?nodeId=&date=Quote again (another departure or tier); promising.promises.made{reason=...} shows the trend
409 promise-hold-expired on confirmThe PROVISIONAL hold passed holdExpiresAt (holdTtlMinutes); the sweeper releases such promises every SWEEP_INTERVALGET /promises/{id} state RELEASEDMake a new promise from a fresh quote; confirm earlier in checkout
409 illegal-transitione.g. cancelling a PROVISIONAL, KEPT, BROKEN or RELEASED promise (ADR 0002 A30)promise stateOnly CONFIRMED or AT_RISK promises can be cancelled
409 concurrent-updateAnother request changed the aggregate; the use case already retried 3 times (usecases.MaxAttempts). POST /promise-policies returns it too when another version wonRetry immediatelyRe-fetch and retry; for policies read GET /promise-policies/current first
400 malformed-request: json: unknown field "x"Request bodies are decoded strictly (unknown fields refused)The detail names the field (the quote's line field is catalogItemId, not itemId)Use the names in the OpenAPI contract
A node that used to win SAME_DAY or NEXT_DAY is no longer offered, or the tier shows DELIVERY_SLA_UNAVAILABLE while TWO_DAY and STANDARD still quotenode-performance revoked the node's fast-tier eligibility (ADR 0022); deliverypromise_tier_candidates_excluded_total{tier} risesSELECT node_id, tier, changed_at FROM rm_node_tier_eligibility WHERE NOT eligible;Nothing to fix here: the node is reinstated by node-performance's NodeTierEligibilityChanged (eligible=true) after three good days. A row that should be gone means that event was not consumed
Quote returns unavailable constraints onlyDESTINATION_NOT_SERVED, ITEM_QUANTITY_NOT_AVAILABLE, DELIVERY_SLA_UNAVAILABLE, NODE_CAPACITY_EXHAUSTED or PAST_ORDER_DEADLINE. The local read models (rm_*) are empty or stale when the producers' events have not been consumedSELECT (SELECT count(*) FROM rm_nodes) nodes, (SELECT count(*) FROM rm_departures) departures, (SELECT count(*) FROM rm_waves) waves, (SELECT count(*) FROM rm_listings) listings;; consumer logsWait for the consumer to catch up; check the group is reading (below)
A node or listing stays out of the quotes although node-topology or offer-availability reports it active or restoredThe projection keeps the newest fact by CloudEvents time (ADR 0029): an activation or restore OLDER than the stored suspension or suppression is dropped, and a RETIRED node never comes backSELECT data->>'State', data->>'StateAt' FROM rm_nodes WHERE id = '<nodeId>'; and SELECT data->>'Suppressed', data->>'SuppressedAt' FROM rm_listings WHERE id = '<listingId>';Nothing to fix here when the stored fact is newer; a genuinely newer activation or restore applies on arrival. A retired node is replaced by a new node id, not revived
500 internal-errorAn untyped error or a recovered panic; the response never leaks the causeERROR access-log line with request_id, then the same trace_idFix from the log; promising.promises.made{reason="internal-error"} rises

Outbox​

SymptomCauseCheckFix
Events not appearing on retailnetwork.delivery-promise.events / .analytics, outbox relay pass failed every secondKafka unreachable or the topic has no leader yet (first write auto-creates it, UnknownTopicOrPartition)SELECT count(*) FROM outbox_events WHERE published_at IS NULL; growsRestore Kafka. A first-write error self-heals. Rows publish 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 row failed OUTBOX_MAX_ATTEMPTS (20) timesSELECT id, event_type, topic, attempts, last_error FROM outbox_events WHERE published_at IS NULL AND attempts >= 20;Fix the cause (last_error), then UPDATE outbox_events SET attempts = 0 WHERE id = <id>;. Later rows overtake the parked one meanwhile. OUTBOX_MAX_ATTEMPTS=0 removes the cap (not recommended)
The same event arrives twice at a consumerDelivery is at-least-once with a stable CloudEvents idCompare idsConsumers deduplicate on id; this service does so with processed_events

Consumer​

SymptomCauseCheckFix
Read models empty, no consumer running lineThe consumer starts with cmd/api only; cmd/mcp and cmd/a2a never consumeapi pod logsLook at the api pod
Repeated retry logs on one topic (handling failed; retrying the same message, with attempt, max_attempts, retry_in)A transient failure, usually Postgres down mid-handler. Backoff 200 ms doubling to 5 s, up to 5 attemptspartition and offset in the logRestore Postgres. After 5 attempts the message goes to <topic>.dlq with x-dlq-source-topic, -partition, -offset, x-dlq-error, x-dlq-failed-at headers
WARN dead-lettering an event that can never be applied then ERROR message can never be applied; dead-lettering it without retryA known event type whose data cannot be decoded or lacks a required id (malformed event payload)The log names type and event_id; read the .dlq topicFix the producer. The message is committed past.
WARN skipping a message that is not a valid CloudEventThe message is not CloudEvents 1.0error fieldNothing is retried or dead-lettered; fix the producer
WARN ... broker connection stalled or lost; fetching again after the backoffIdle TCP connection dropped (conntrack, sidecar). Recovers by rediallingattempt counterIgnore a blip; after 10 consecutive failures the worker fails and the pod restarts
Consumer logs retries on a topic that does not exist yetTopics are auto-created by the first writer; a producer that has not written yet leaves its topic missingkafka-topics --listWait for the producer; this never makes /readyz fail
WARN order placed with an unknown promiseCustomerOrderPlaced referenced a promiseId this service never held (for example data from another environment)orderId, promiseId in the logInformational: the event is skipped

MCP and A2A​

SymptomCauseCheckFix
MCP tools/list fails without a sessionStreamable HTTP needs initialize first; the Mcp-Session-Id response header must be sent on later calls, and Accept: application/json, text/event-streamcurl -i on initializeSee Quickstart
A2A error -32009 this version is not supported: requested "0.3", served "1.0" (VERSION_NOT_SUPPORTED)The client sent no A2A-Version header (treated as 0.3) or another versionRequest headersSend A2A-Version: 1.0
A2A answers a problem inside the message instead of a JSON-RPC errorBy design: 400 request shape (including unknown fields and not exactly one of orderId/promiseId), 404 not-found, 422 validation-failed, 500 internal-errorThe Data part problem.statusFix the arguments
Agent Card advertises the wrong URLA2A_AGENT_URLGET /.well-known/agent-card.json, supportedInterfaces[0].urlCorrect the variable and restart
cmd/mcp or cmd/a2a returns empty results while the api has dataDifferent DATABASE_URL (they read the database cmd/api owns)env on each podPoint all three at the same database
Calls get 401/403They do not: the surfaces carry no authentication; the in-cluster boundary is the access control. A 401 comes from something in front (a gateway, a client)curl the Service directlyLook at the proxy

Telemetry​

SymptomCauseCheckFix
No traces or metrics in GrafanaThe Collector is absent or OTEL_EXPORTER_OTLP_ENDPOINT is wrong (default localhost:4317). Export never blocks, so nothing else breaksLOG_LEVEL=debug shows opentelemetry error records; log telemetry configured shows the endpointSet the endpoint (chart otel.endpoint)
Log lines without trace_idWritten outside a span (boot, workers) or with the non-Context slog APIExpectedNone