Skip to main content

Troubleshooting

Each entry is symptom, then cause, then how to check, then the fix. Causes come from the code paths named in the entry; log messages are quoted exactly as the code writes them (see Observability for the fields). Procedures such as re-driving a dead letter or re-arming an outbox row are in the Runbook.

Boot and readiness​

SymptomCauseCheckFix
cmd/api exits 1 at once with service exited with error and DATABASE_URL is required, KAFKA_BROKERS is required, DELIVERY_PROMISE_URL is required, or <NAME> is required: the consumer always runs on real KafkaA mandatory variable is empty. cmd/api reports the first missing one in the order database, brokers, delivery-promise URL, then the three consumer groups (cmd/api/config.go)the error text names the variableSet it; the full table is on Configuration. In Helm the chart refuses to render and names the missing value
DELIVERY_PROMISE_TIMEOUT: "..." is not a positive Go duration or CART_CURRENCY: "..." is not a three-letter upper-case currency code at bootMalformed valuethe error quotes itUse 5s style durations and a code such as USD (upper case)
cmd/a2a exits 1 with A2A_AGENT_URL is required or A2A_AGENT_URL=... is not an absolute http(s) URLThe Agent Card must advertise the URL clients dial, so a relative or schemeless URL is refused (ADR 0006)cmd/a2a prints every problem at onceSet A2A_AGENT_URL to an absolute URL; in Helm set a2a.agentUrl when the agent must be reachable outside the cluster
Repeated retrying WARN lines with op = run migrations or ping postgres, then service exited with errorPostgres is unreachable or the first dial was reset (sidecar not ready). Both steps retry with bounded backoff (internal/bootretry) and then give upthe err field of the last retrying lineFix connectivity or the DSN. The startup probe allows about 60 s
Migration hangs and the pod never becomes liveMIGRATIONS_DATABASE_URL falls back to DATABASE_URL, which goes through a transaction-mode pooler; the migration takes a session-scoped advisory lockno postgres adapters configured linePopulate MIGRATIONS_DATABASE_URL with a direct, non-pooled DSN
Pod is live but /readyz answers 503 with dependency-unavailable and detail not ready: kafka (or postgres, or both)The broker did not answer a topic-less metadata request, or Postgres did not answer a ping, within 2 s (verdict cached 3 s)WARN readiness: dependency is not ready with dependency and errorRestore the dependency. The pod is deliberately not ready but alive, so Kong stops routing to it; no restart is needed. Check KAFKA_BROKERS for typos
/readyz answers 503 {"status":"not_ready"}Shutdown has started: the drain gate flipped firstshutdown: readiness flipped to not-ready in the logExpected during a rollout. If it never recovers the pod is terminating
Pod restarts in a loop; last log line is <worker> stopped unexpectedly: exiting so the orchestrator restarts the serviceThe relay, a consumer or a sweeper returned on its own. For a consumer this is a hard broker error (connection refused, protocol or group error) or more than 10 consecutive lost-connection retrieskubectl logs --previous; the ERROR before it (consumer stopped, outbox relay stopped, scheduler stopped) carries the causeFix the broker or network; the restart is by design. The WarehousePodRestarting alert fires at two restarts in 15 minutes
Shutdown is cut short, worker did not stop before the shutdown drain deadlineA worker needed more than 10 s to stopthe WARN names the workerKeep terminationGracePeriodSeconds above the drain delay plus 75 s (the chart default is 80)

Carts and the read models​

SymptomCauseCheckFix
Every POST /carts/{cartId}/lines answers 422 item-not-purchasableThe local copy of the catalogue (rm_items) does not mark the item as catalogued, not discontinued and priced. It is fed only by Kafka (CatalogItemCreated, ItemPriceChanged); it is empty on a fresh database, and an item discontinued upstream or whose price was withdrawn is refusedSELECT * FROM rm_items WHERE catalog_item_id = '<id>'; the cart.lines.added counter with reason=item-not-purchasableMake sure offer-availability and pricing publish to this broker and that the pricing and offer-availability consumers are running (consumer running lines, no lag). A producer that published before this service's groups first started is only read if the topic retained the messages
Add-line works for some items and is refused for othersThe row exists with catalogued = false (a price event arrived before CatalogItemCreated, so the row is a stub) or priced = falsethe same queryWait for the missing event, or ask the producer to republish
The estimate shows estimateComplete: false or zero chargesrm_current_schedule or rm_current_tax_table is empty or an item has no price; the estimate is labelled non-binding and incomplete rather than guessedSELECT version FROM rm_current_schedule; same for rm_current_tax_tableSame as above: the pricing events DeliveryChargeScheduleChanged and TaxTableChanged must arrive. CART_CURRENCY is only the fallback currency before any price states one
A retry after a failed call keeps returning the same error even though the cause is fixedIdempotency replay classes (ADR 0011): a 2xx and a FINAL refusal (malformed-request, quantity-out-of-range, validation-failed, cart-closed) are stored for 24 hours and replayed (header Idempotency-Replayed: true); a RETRYABLE refusal (not-found, concurrent-update, stale-delivery-selection, item-not-purchasable, too-many-lines, no-destination, merge-target) and a 5xx are never stored — the key is released and the same key runs again. A stored FINAL answer repeats because the request itself keeps being invalidthe response header; SELECT status, created_at FROM idempotency_keys WHERE key = '<key>'Fix the request for a FINAL refusal or use a new Idempotency-Key; a RETRYABLE refusal needs nothing — retry the same key once the cause is gone
POST answers 400 idempotency-key-requiredThe Idempotency-Key header is missing (every POST route requires it)request headersSend a unique key of 1 to 128 printable ASCII characters per logical request
POST answers 400 idempotency-key-invalidThe key is longer than 128 characters or has a character outside printable ASCIIrequest headersSend a unique key of 1 to 128 printable ASCII characters
POST answers 409 idempotency-key-reusedThe same key was sent with a different method, path or body (the key is global: another route or cart counts)compare with the first requestUse a fresh key for a different request
POST answers 409 concurrent-updateAnother writer changed the cart between its load and save (version guard). The command is already retried once internallyrepeats under load on one cartRetry the call; the client holds a stale view
POST /carts/{cartId}/delivery-quotes answers 503 delivery-promise-unavailabledelivery-promise timed out (DELIVERY_PROMISE_TIMEOUT, default 5 s), refused the connection, answered 5xx or an undecodable body, or answered 4xx (a rejected request is reported the same way and is a contract bug)DELIVERY_PROMISE_URL; reach POST /delivery-quotes on it by hand; a 4xx detail is inside the error chain, not in the responseFix the URL or the dependency, then retry with the same Idempotency-Key; a 5xx was not stored. Nothing else in the service needs delivery-promise
Delivery dates are one day off, or WARN delivery window time zone unusable; delivery dates fall back to UTCThe offer window named no timeZone, Local, or a name the zone database does not know, so dates use UTC instead of the destination's calendar day (ADR 0007). The image embeds tzdata (cmd/api/tzdata.go)the timeZone and reason fields; logged once per zone nameFix delivery-promise to send an IANA zone for the serving station
422 no-destination on POST /carts/{cartId}/delivery-quotesThe cart has no destination postal prefix yetGET /carts/{cartId}, destinationPostalPrefix is nullCall PUT /carts/{cartId}/destination first
409 stale-delivery-selection on PUT /carts/{cartId}/delivery-selectionThe offer id is not in the cart's current quote (the destination or lines changed and the quote was cleared, or a requote replaced it)the quote of the cartQuote again and select from the new offers
409 cart-closedThe cart is CHECKED_OUT, ABANDONED or MERGED; those states never changestate of the cartCreate or use another cart
422 merge-target on POST /carts/{cartId}/mergesThe target is the cart itself, is not OPEN, belongs to no shopper (a guest cart), or the source has a shopper different from the target'sboth carts' state and shopperIdMerge a guest cart or a cart of the same shopper into an open cart that has a shopper
422 quantity-out-of-range or too-many-linesQuantity must be 1 to 99; a cart holds at most 100 linesthe request bodyCorrect the request
400 malformed-requestBad JSON, an unknown field, a wrong type, a body over the size limit, or a NUL character (U+0000) in the query string or a JSON body (a NUL in the URL path is 404 resource-not-found)the detailFix the request. NUL is a uniform client error (internal/adapters/inbound/http/nul.go), never a 500
404 not-found for a cart that existedA cart that is no longer OPEN and idle for 30 days is deleted by PurgeAbandonedCarts. A path identifier over 128 characters also answers 404GET /carts?shopperId=...Expected after retention
500 internal-errorAn unmapped error. The response never shows the causethe ERROR http request line with the same trace_id, and the log lines of that spanRead the log; the usual cause is a database error

REST problem types​

Every error is application/problem+json with type /problems/<slug> (internal/adapters/inbound/http/errors.go).

SlugStatusRaised when
malformed-request400body or parameter the adapter rejects
idempotency-key-required400missing Idempotency-Key
idempotency-key-invalid400Idempotency-Key over 128 characters or not printable ASCII
not-found404unknown cart, or a line that is not in the cart
resource-not-found404a NUL character in the request path
cart-closed409the cart is no longer OPEN
stale-delivery-selection409the selection names an offer outside the current quote
illegal-transition409the state machine does not allow the change
concurrent-update409version guard lost the race twice
item-not-purchasable422the item is not catalogued, discontinued or unpriced
quantity-out-of-range422quantity outside 1 to 99
too-many-lines422more than 100 lines
no-destination422quote requested before a destination
merge-target422invalid merge target
validation-failed422a value the domain refuses
idempotency-key-reused409the same key with a different request
delivery-promise-unavailable503delivery-promise failed or rejected the quote
dependency-unavailable503/readyz: Postgres or Kafka unreachable
internal-error500anything else

Consumers and dead letters​

SymptomCauseCheckFix
consumer running but no event processed even at LOG_LEVEL=debug, and rm_items stays emptyThe topic does not exist yet or nothing is published to it on this broker. The service never creates topics for consumingkafka-topics.sh --list; consumer-group lag with kafka-consumer-groups.sh --describe --group <group>Make the producing context publish to the fleet broker (localhost:9092 locally); no restart is needed once the topic exists
WARN skipping a message that is not a valid CloudEventA message on a consumed topic is not CloudEvents 1.0 structured JSONthe topic and error fieldsFix the producer. The offset is committed past it
Events arrive but nothing changesThe type is not one the consumer handles, so it is ignored silently. Dispatch is on the full type string (for example com.retailnetwork.storefront.pricing.itemprice.ItemPriceChanged)compare the type with EventsFix the producer's type string
ERROR ... message can never be applied; dead-lettering it without retry, WARN dead-lettering an event that can never be appliedThe payload is undecodable, a required field (catalogItemId, currency, cartId, sessionId) is empty or over 200 characters, a schedule has zero or more than 16 tiers, a tax table zero or more than 1000 bands, or the value fails domain validationthe error field; the headers of the message on <topic>.dlq (x-dlq-error)Fix the producer, then re-drive (Runbook). The message is on the DLQ and the partition has moved on
ERROR ... handling failed; retrying the same message with the same partition and offsetA transient failure (usually Postgres) repeats; five attempts with 200 ms doubling to 5 s, then it is dead-letteredthe error fieldFix the database; the dead-lettered message can be re-driven
ERROR ... dead-letter publish failed; retrying the same message repeatingThe DLQ write fails (broker down). It retries forever and never drops the message, so this partition is blockedbroker healthRestore the broker; the consumer resumes by itself
WARN ... broker connection stalled or lost; fetching again after the backoffAn idle connection timed out or was reset; the reader redials. Up to 10 in a row are toleratedattempt and backoffNothing, unless it reaches 10 and the pod restarts
Duplicate-looking effects after a replayRedelivery is a no-op through the inbox (processed_events on the CloudEvents id)SELECT * FROM processed_events WHERE event_id = '<id>'None. A producer that mints a new id per retry defeats it
A price or schedule did not change although an event arrivedPrice, schedule and tax events are applied only when their version is above the stored one (version guard), so stale or reordered events are acknowledged and ignoredrm_items.price_version, rm_current_schedule.versionProducers must send increasing versions
WARN CheckoutCompleted names an unknown cart / for a cart that is not opencheckout reported a cart that was purged, never existed here, or is already closed. It is acknowledged and nothing changesthe cartId and stateUsually none; check the checkout side if frequent

Outbox relay​

SymptomCauseCheckFix
Analytics events are not appearing on retailnetwork.shopping-cart.analytics; ERROR outbox relay pass failedThe broker is unreachable or rejects the write. The row stays unpublished and its attempts and last_error growSELECT id, event_type, attempts, last_error FROM outbox_events WHERE published_at IS NULL ORDER BY id LIMIT 20Restore the broker; the relay drains in id order by itself. No shopper request is affected
ERROR outbox relay: row reached the attempt cap and is excluded from future claims; re-arm it with attempts = 0 after fixing the causeOne row failed OUTBOX_MAX_ATTEMPTS times (default 20) so it cannot block the restthe outbox_id and error fieldsFix the cause, then UPDATE outbox_events SET attempts = 0 WHERE id = <id>
Backlog grows slowly with no errorsOUTBOX_RELAY_INTERVAL is large, or the rate exceeds 100 rows per passoutbox relay running shows the intervalLower the interval; a full batch is followed by another pass at once
A consumer of the analytics topic sees the same event twiceDelivery is at-least-once; the CloudEvents id is stable across retriesthe idConsumers must dedupe on id

Sweepers​

SymptomCauseCheckFix
Idle open carts never become ABANDONEDThe cart is idle for less than 30 days, or the tick did not run or failedscheduled sweep done / scheduled sweep failed; trying again at the next tick with job AbandonInactive and handled; ABANDON_SWEEP_INTERVALWait for the next tick (default 1 h) or fix the database error shown
Closed carts pile upPurgeAbandonedCarts deletes a non-open cart idle for 30 days; it ticks every PURGE_SWEEP_INTERVAL (default 6 h)the same lines with job PurgeAbandonedCartsWait, or fix the error
Warning invalid ABANDON_SWEEP_INTERVAL; using the defaultThe value is not a positive Go durationthe value fieldUse 30m style values

A2A agent​

SymptomCauseCheckFix
The Agent Card advertises an unreachable URLA2A_AGENT_URL is what the card says; the default in-cluster Service DNS is wrong off-clustercurl .../.well-known/agent-card.jsonSet a2a.agentUrl (or A2A_AGENT_URL) to the gateway URL
A skill call answers a problem inside a normal replySkill errors are answered in-band, not as JSON-RPC errors: malformed, unknown skill, cart not found, validation. The request must be one data part (or a text part holding the same JSON) with skill and arguments, and unknown fields are refusedthe problem of the reply envelopeSend {"skill":"get_cart","arguments":{"cartId":"..."}}; see API reference
The agent answers but REST shows a different currencyCART_CURRENCY differs between the binariesall environmentsSet the same value on the api, a2a and mcp
The agent fails to start while REST worksIt reads only Postgres; a missing A2A_AGENT_URL or DATABASE_URL is the usual causethe boot errorSet both

Telemetry​

SymptomCauseCheckFix
No traces or metrics in GrafanaThe Collector is down or OTEL_EXPORTER_OTLP_ENDPOINT points elsewhere. Export never blocks, so the service stays healthy and drops telemetry silentlyLOG_LEVEL=debug shows opentelemetry error; the telemetry configured line shows the endpointFix the endpoint or the Collector
Log lines have no trace_idOnly *Context slog calls inside a span carry it; boot, shutdown and background lines never dothe line's originExpected