Skip to main content

Troubleshooting

Symptom, cause, check, fix, built from the failure modes visible in the code. Log lines and REST bodies are quoted from cmd/api and checked against a real run (Quickstart). SQL probes use the tables listed in the Runbook. This service calls no other service over HTTP, MCP or A2A, so there is no circuit breaker to trip; the dependencies that can fail are Postgres and Kafka.

Boot​

SymptomLikely causeCheckFix
cmd/api exits 1 at once: missing required environment variable: DATABASE_URL (same wording for KAFKA_BROKERS (comma-separated host:port list), NODE_TOPOLOGY_CONSUMER_GROUP, SELLER_INBOUND_CONSUMER_GROUP and CUSTOMER_RETURNS_CONSUMER_GROUP)A mandatory variable is unset or blank; there is no in-memory or consumer-less modeThe error returned by run (cmd/api/config.go, loadConfig); the pod's envSet it (Configuration); the group id is a stable service-prefixed name you choose, never defaulted
cmd/mcp or cmd/a2a exits 1: DATABASE_URL is required: this context runs on real PostgresNo database DSNThe binary's stderrSet DATABASE_URL
cmd/a2a exits 1 before it binds, naming A2A_AGENT_URLUnset, relative or schemeless agent URL; all boot problems are reported togethercmd/a2a/main.goAn absolute http(s) URL, for example http://localhost:8093/
Warning invalid OUTBOX_RELAY_INTERVAL; using the default (also OUTBOX_MAX_ATTEMPTS, RETENTION_INTERVAL)Optional value does not parse or is non-positiveThe WARN line has value and defaultFix the value, or unset it; the service runs on the default meanwhile
Exits 1 after about 15 s: run migrations or ping postgres errors after WARN retrying lines (op, attempt, in, err)Postgres unreachable, wrong DSN, or a migration fails; 5 attempts with 1, 2, 4, 8 s backoff, then the process refuses to bootThe WARN lines and the final error; psql "$DATABASE_URL" from the same networkFix DSN or network. The retry exists because the first dial of an injected pod can be reset, it is not a license to boot without a database
Migration fails on every later bootA partial migration left schema_migrations.dirty = true and golang-migrate refuses to continueSELECT version, dirty FROM schema_migrations;Repair the schema by hand and force the version with the golang-migrate tooling (take a backup first)
Migrations hang or fail behind PgBouncerDATABASE_URL is a transaction-pooling address, which breaks golang-migrate's session advisory lockIs the DSN a pooler?Set MIGRATIONS_DATABASE_URL to a direct connection
helm template / helm install failsThe chart refuses: no database source, no or blank kafka.brokers, empty config.nodeTopologyConsumerGroup, a *_MODE entry in extraEnv, terminationGracePeriodSeconds below SHUTDOWN_DRAIN_DELAY + 25 s, or a config.shutdownDrainDelay that is not 0 or a whole number of ms, s, mThe fail message names the valueFix the values (Runbook)

Probes and runtime​

SymptomLikely causeCheckFix
/readyz 503 {"status":"not_ready"}The process is draining after SIGINT/SIGTERMIs the pod terminating?Nothing to fix; a new pod takes over
/readyz 503 application/problem+json, type dependency-unavailable, detail naming postgres or kafkaPostgres does not answer a ping, or no Kafka broker answers a metadata request. A missing topic never causes it: the request names no topicWARN readiness: dependency is not ready has dependency and errorRestore the dependency; the verdict is re-checked after at most 3 s. /healthz stays 200 throughout
/readyz 200 but requests fail with 500One query failing for another reason (statement timeout 10 s, constraint, bug); readiness only proves a pinghttp request ERROR lines with status 500; panic in handler; psql from the podFix the cause shown in the log
A write succeeds (201) but nothing appears on KafkaExpected while the broker is down: the event waits in outbox_eventsSELECT count(*), min(created_at) FROM outbox_events WHERE published_at IS NULL; and /readyzRestore Kafka; the relay drains in id order
cmd/mcp or cmd/a2a has no /readyzThey expose /healthz onlyProbe /healthz
Process exits non-zero with ERROR outbox relay stopped, node-topology consumer stopped or retention janitor stoppedA worker loop returned on its own; by design the process then exits so the orchestrator restarts itThe error field of that ERROR line, then ... stopped unexpectedly: exiting so the orchestrator restarts the serviceFix the named cause; kubectl rollout restart deploy/offer-availability

Kafka, the outbox and the consumer​

SymptomLikely causeCheckFix
ERROR outbox relay pass failed repeating, published_at stays NULLBroker unreachable, or auto-creation of retailnetwork.offer-availability.events is disabled and the topic is missing (the first pass in a fresh local broker can fail once with Unknown Topic Or Partition and the next pass succeeds)The error field; last_error and attempts on the head rowRestore the broker or create the topic. The pass retries every OUTBOX_RELAY_INTERVAL
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, about 20 s at 1 s)SELECT id, topic, 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>;. While a row is excluded, later events of the same aggregate can overtake it
Node events are produced but listings never change; no event processed lineThe consumer is not attached: the consumed topic did not exist when cmd/api started (observed in the capture: events produced later were never received until a restart), or another process holds the consumer groupnode-topology consumer running (topic, group) at boot; kafka-consumer-groups.sh --describe --group <group> (no assignment = not attached)Create retailnetwork.node-topology.events before starting, then restart the api. Never share NODE_TOPOLOGY_CONSUMER_GROUP with another environment
Seller events are produced but a suspended seller's listings stay LIVE; no event processed line for SellerSuspendedThe seller-inbound consumer is not attached: retailnetwork.seller-inbound.events did not exist when cmd/api started, or another process holds SELLER_INBOUND_CONSUMER_GROUPseller-inbound consumer running (topic, group) at boot; kafka-consumer-groups.sh --describe --group <group>Create retailnetwork.seller-inbound.events before starting, then restart the api (ADR 0013)
A seller's shipment was received but no listing of the seller appearedThe received line did not resolve (its GTIN is held by no catalogue item, or its catalogItemId is unknown), or the event predates the producer's received listWARN a received line resolves to no catalogue item; skipped (gtin, reason); availability_seller_events_ignored_total{reason=~"gtin_unresolved|item_unknown|received_unknown"}Declare the pack level of that GTIN, then POST /listings with ownerRef; an existing listing is never touched, so nothing else is needed (ADR 0014)
WARN node-topology consumer broker connection stalled or lost; fetching again after the backoffTransient timeout, reset or EOF on the fetch; up to 10 consecutive failures are slept off with capped backoffattempt and backoff fieldsNone while it recovers. After 10 failures, or on a non-transient error such as connection refused, the loop returns and the process exits for a restart
ERROR node-topology consumer handling failed; retrying the same message (partition, offset, attempt, max_attempts 5, retry_in)A transient failure, usually Postgres: the unit of work rolled backThe error field; database healthFix the dependency. After 5 attempts the message goes to the DLQ and the partition moves on
ERROR node-topology consumer message can never be applied; dead-lettering it without retry or WARN an event can never be applied; it goes to the dead-letter topicPayload without nodeId or without the instant (activatedAt, suspendedAt, retiredAt, or the CloudEvents time for NodeRegistered), undecodable data, or a value the use case refusesThe type and event_id fields; the x-dlq-error header of the DLQ recordFix the producer (node-topology), then re-publish the original value to the source topic; the inbox makes a re-send harmless
Messages on retailnetwork.node-topology.events.dlqSee the two rows abovekafka-console-consumer.sh --topic retailnetwork.node-topology.events.dlq --from-beginning --property print.headers=true; headers x-dlq-source-topic, x-dlq-source-partition, x-dlq-source-offset, x-dlq-error, x-dlq-failed-atNothing drains the DLQ; it is an operator task (Runbook)
WARN skipping a message that is not a valid CloudEventA non-CloudEvents message on the topicThe error fieldNone; it is skipped and the offset moves on. A valid CloudEvent of a type this service does not consume is skipped silently
A listing stays SUPPRESSED with NODE_NOT_SELLABLEThe local node status is not ACTIVE: no NodeActivated was consumed (an unknown node is not sellable), or the node was suspended or retiredSELECT * FROM node_status_view WHERE node_id = '<node>';Wait for or re-send NodeActivated. A RETIRED node never comes back, and an older event never overrides a newer status
A listing stays SUPPRESSED with DISCONTINUEDIts catalogue item was discontinued; discontinuation is finalGET /catalog/{catalogItemId} shows state: DISCONTINUEDCreate a new catalogue item; a node event never restores this reason

Inventory feeds​

SymptomLikely causeCheckFix
POST /inventory-feeds 422 listing-not-on-nodeA line names a listing that does not exist (yet: listings are also created from events) or belongs to another node. The feed is recorded as FAILED and nothing else changes; the answer is not stored, the Idempotency-Key is freeGET /inventory-feeds/{feedId} shows state: FAILED, failureCodeRetry the same request with the same key once the listing exists (it turns APPLIED), or correct the lines and re-send the same feedId
422 negative-availabilityA line has availableQty below 0; recorded as FAILED, and the 422 is stored with it (a retry under the same key replays it)As aboveCorrect the quantity and re-send the same feedId with a new Idempotency-Key
409 feed-already-appliedThe feedId is already APPLIED or SUPERSEDEDGET /inventory-feeds/{feedId}Use a new feedId for new data
A feed is SUPERSEDED, no listing changedIts asOf is older than the last APPLIED feed of the node (kept per node in node_feed_marks)SELECT * FROM node_feed_marks WHERE node_id = '<node>';Expected ordering behaviour; send a feed with a later asOf
appliedCount is lower than lineCount, staleCount above 0A line is older than the availability the listing already holdsstaleCount on the feedExpected; that line is skipped
A full feed (fullUpdate: true) zeroed listingsBy design: listings of the node omitted from a full feed are set to 0zeroedCountSend the missing lines, or use a partial feed
422 validation-failed on a feedMore than 10000 lines, a partial feed with no line, the same listing twice, a bad id, a missing asOf, an unknown basis, a quantity above 2147483647The detail text; nothing is recorded for a malformed requestFix the request

REST problem types​

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

StatusSlugWhenWhat to do
400malformed-request-bodyInvalid JSON, unknown field, wrong type, trailing data, or a NUL characterFix the body against apis/openapi.yaml
400malformed-request-queryA bad query string (a NUL character, an unparsable value)Fix the query
400idempotency-key-requiredA state-changing route without an Idempotency-Key headerSend a unique key per logical request
400idempotency-key-invalidKey longer than 200 characters or with control charactersUse a shorter printable key
404not-foundUnknown catalogue item or feed id, or no route matchesNormal for an unknown id
404pack-level-not-foundThe item never declared that pack levelDeclare it first
405method-not-allowedWrong verb for a path
409illegal-transitionA state change the aggregate refusesRead the detail
409concurrent-updateTwo writers raced on one aggregate; the version guard failedRe-fetch and retry
409gtin-already-assignedThe GTIN already identifies an item or a pack level (retired ones included)A GTIN identifies one thing forever; use another
409pack-quantity-immutableunitsPerPack of an active pack level cannot changeRetire the level and declare a new GTIN
409duplicate-listingA listing of this item on this node (and owner) existsRead it with GET /listings?nodeId=&catalogItemId=
409stale-availability, node-not-sellableDomain refusals of the listing aggregateRead the detail
413request-body-too-largeBody over 64 KiBSplit the request (a feed carries at most 10000 lines)
422invalid-gtinNot 8, 12, 13 or 14 digits, a wrong mod-10 check digit, or a variable-measure GTINFix the GTIN
422invalid-item-dimensions, invalid-pack-dimensions, invalid-pack-quantity, invalid-pack-level, pack-level-orderPackaging rules (ADR 0006): positive dimensions, unitsPerPack up to 1000000 and consistent with the child chain, level one of EACH, INNER, CASE, PALLET, an active lower child levelRead the detail
422negative-availability, listing-not-on-node, validation-failedFeed and value-object rulesSee the feed table
422idempotency-key-reusedThe same key with another method, path or body, or the key expired while the request was in flightNew key, or resend the original request to get the stored answer
500internal-errorUnmapped error or handler panic; detail is always an unexpected error occurredRead the http request ERROR line and panic in handler
503dependency-unavailableGET /readyz onlySee the /readyz row above

Idempotency in practice​

The rule and the class of every problem type: ADR 0016.

  • The key is global (idempotency_keys, 24 hours) and keys only the POST routes; PUT takes none. The same key with the same method, path and body replays a stored answer with Idempotency-Replayed: true.
  • What is stored depends on the answer. A 2xx is stored. A refusal is stored only when it is final for that request (FINAL: gtin-already-assigned, duplicate-listing, feed-already-applied, invalid fields, ...) or an outcome that was committed (OUTCOME: negative-availability, whose FAILED feed commits with the stored 422).
  • A refusal the same request can pass later (RETRYABLE: concurrent-update, not-found, pack-level-not-found, illegal-transition, node-not-sellable, validation-failed, listing-not-on-node) and every 5xx or panic is not stored: the key is released and a retry under the same key runs again. A different body under a released key is a new request, not idempotency-key-reused. listing-not-on-node still keeps its FAILED feed (GET /inventory-feeds/{feedId}).
  • Two concurrent requests with one new key serialize on the idempotency_keys primary key; the second waits. If the first is stored, the second replays it; if the first was released, the second runs the work itself.
  • Expired keys are purged by every keyed write and by the hourly janitor.

MCP and A2A​

SymptomLikely causeCheckFix
MCP tools/list refused: method "tools/list" is invalid during session initializationNo initialize and notifications/initialized on this sessionQuickstartInitialise first and send Mcp-Session-Id
An MCP tool answers isError: true with not-found: not foundUnknown idNormal
A tool fails with validation-failedlimit outside 1 to 500Use a valid page size
Writes over MCP or A2ANot available: both are read-only (ADR 0007, ADR 0010)Use REST
A2A answer carries a problem instead of datamalformed-skill-request (no parts, no skill, unknown field), unknown-skill, invalid-argument (all status 400 in the data part), or not-found / validation-failed from the read; answered as a business reply, not a transport errorThe problem in the reply's data partFix the request (API overview)
Agent Card advertises the wrong URLA2A_AGENT_URLGET /.well-known/agent-card.jsonSet the externally reachable URL