Skip to main content

Troubleshooting

Symptom, cause, check, fix, built from the failure modes visible in the code. Log messages are quoted from the source; REST problem slugs from internal/adapters/inbound/http/errors.go. SQL probes assume the Postgres schema in the Runbook. Nothing here was captured from a live run of this branch. The context has no circuit breaker: the four sibling REST calls are plain HTTP calls with timeouts (internal/adapters/outbound/httpclient/client.go), and the dependencies that can fail are Postgres, Kafka and those four services.

Boot​

SymptomLikely causeCheckFix
Process exits 1 at once, service exited with error with DATABASE_URL is required: this context runs on real Postgres, there is no in-memory modeDATABASE_URL unsetThe error field of the ERROR line (cmd/api/main.go)Set it (Configuration). There is no in-memory runtime to fall back to
Exits 1 with KAFKA_BROKERS is required: this context runs on real Kafka (outbox relay, consumers, /readyz)Empty or blank KAFKA_BROKERSSame lineSet host:port[,host:port]. Only cmd/api needs it; cmd/mcp and cmd/a2a never read it
Exits 1 with <NAME> is required: the consumer always runs on real Kafka (NODE_CONSUMER_GROUP, LISTING_CONSUMER_GROUP, SOURCING_CONSUMER_GROUP, INBOUND_CONSUMER_GROUP, PACKAGING_CONSUMER_GROUP)A consumer group id is unset. The first missing one is reported, then the next boot reports the nextPod env; chart config.*ConsumerGroupSet all five stable names (the chart refuses to render without the first three plus the two inbound ones)
Exits 1 with <NAME> is required: the in-organization call it names has no defaultOne of NODE_TOPOLOGY_URL, OFFER_AVAILABILITY_URL, SHIPPING_AND_TRACKING_URL, NODE_PERFORMANCE_URL is unset. cmd/mcp and cmd/a2a refuse the same fourPod envSet the base URLs; in-cluster they are http://<context>.warehouse-systems.svc.cluster.local:80
Exits 1 with EVENT_PUBLISHER=log is not supported: this context publishes to real Kafka or EVENT_PUBLISHER: unknown value "x" (want kafka)A manifest still sets the retired log publisherPod envRemove the variable or set kafka
Exits 1 with TX_PROCESSING_DELAY: "abc" is not a valid duration (want a positive Go duration such as 500ms), or SUBMISSION_POLL_INTERVAL / EXPIRY_SWEEP_INTERVAL with the same textNot a Go duration, or negative; zero is refused for the two intervals (it is allowed only for TX_PROCESSING_DELAY)cmd/api/config.go parseDurationUse 500ms, 2s, ... or unset for the default
Exits 1 with TX_FAILURE_RATE: "2" is not a number between 0 and 1 (same for PO_REDELIVERY_RATE) or RATE_LIMIT_RPS: "x" is not a number >= 0Malformed or out-of-range knobPod envFix the value; leave the simulation knobs unset in production
A typo in OUTBOX_RELAY_INTERVAL, OUTBOX_MAX_ATTEMPTS or SHUTDOWN_DRAIN_DELAY does not stop the bootThese three log a WARN (invalid OUTBOX_RELAY_INTERVAL; using the default, invalid OUTBOX_MAX_ATTEMPTS; using the default, ignoring invalid SHUTDOWN_DRAIN_DELAY) and use the defaultBoot logsFix the value; the WARN names it
Exits 1 after a few seconds: run migrations (after N attempts): ... or ping postgres (after N attempts): ...Postgres unreachable, wrong DSN, or the migration itself fails. The retry exists because the first dial of a sidecar-injected pod can be reset (internal/bootretry)WARN lines retrying with the operation and error; psql from the same networkFix the DSN or the network
Migrations fail or hang behind PgBouncerDATABASE_URL is a transaction pooler, which cannot hold golang-migrate's session advisory lockIs the DSN a pooler address?Set MIGRATIONS_DATABASE_URL to a direct DSN (cmd/api, cmd/mcp and cmd/a2a all read it and fall back to DATABASE_URL)
Every later boot fails with a migration error after one failed bootA partial migration left schema_migrations.dirty = true; golang-migrate refuses to continueSELECT version, dirty FROM schema_migrationsRepair the schema by hand, then force the version with the golang-migrate tooling; back up first
The pod restarts on its own with <name> stopped unexpectedly: exiting so the orchestrator restarts the serviceA worker (relay, a consumer or a loop) returned on its own; for a consumer, consumer stopped with the fetch error precedes it. A Kafka connection that stays unreachable for more than 10 consecutive fetch attempts fails the consumer on purpose (maxTransientFetchFailures)The ERROR consumer stopped / outbox relay stopped line before the exitRestore the broker. Short stalls (idle read timeouts, resets) are retried with 200 ms-to-5 s backoff and logged as ... broker connection stalled or lost; fetching again after the backoff

Probes and readiness​

SymptomLikely causeCheckFix
/readyz is 503 with {"status":"not_ready"}The process is shutting down; the drain gate flips on SIGINT/SIGTERMIs the pod terminating?Nothing; the replacement takes over
/readyz is 503 application/problem+json slug dependency-unavailable naming postgres and/or kafkaPostgres does not answer a ping, or no Kafka broker answers a topic-less metadata request. A missing topic never causes this: topics are auto-created by the first writerThe /readyz body; internal/adapters/inbound/http/readiness.goRestore the dependency. The verdict is cached 3 s with a 2 s bound, so recovery is automatic
/readyz is 200 but requests fail with 500 internal-errorA single statement failing for another reason (constraint, timeout, bug); readiness only proves the database answers a pingThe request log line (status, route, request_id), then the ERROR next to it; the problem body never carries the causeFix the cause shown in the log
cmd/mcp or cmd/a2a pod is never ready though cmd/api isThey expose only /healthz (liveness, always 200 while serving); a pod that restarts is failing at boot, not at probe timeBoot error line mcp server exited with error or its A2A counterpartSame fixes as Boot: DATABASE_URL and the four neighbour URLs

REST writes​

SymptomLikely causeCheckFix
400 idempotency-key-requiredA write without an Idempotency-Key headerThe request headersSend a unique key of 1 to 128 printable ASCII characters per logical request
400 idempotency-key-invalidThe Idempotency-Key is empty, longer than 128 characters or not printable ASCIIThe request headersSend a conforming key
400 invalid-limit / invalid-cursor / unknown-query-parameterA list was called with a bad or repeated limit, an undecodable cursor, or a query parameter it does not declare (such as the retired nextToken)The query stringUse limit (1 to 500) and the nextCursor of the previous page as cursor
409 idempotency-key-reusedThe same key was used with a different method, path or body (the key is global; the body is compared by SHA-256)SELECT key, route, created_at FROM idempotency_keys WHERE key = '<key>'Use a new key for a new request; replay the identical body to get the stored answer
A retried write returns the old answer, not a new one (Idempotency-Replayed: true)Working as designed: a 2xx and a refusal that is final for the request (partial-acknowledgement, ack-window-closed) are stored for 24 h and replayed for the same key and bodyidempotency_keys.status_codeFor a final refusal, fix the request and use a fresh key
A retried write executes again after a refusalWorking as designed: a refusal that can pass on a retry (concurrent-update, not-found, vendor-suspended, validation-failed, already-acknowledged, label-before-acceptance, confirm-without-label, illegal-transition, node-not-owned-by-vendor, ack-window-out-of-range) and every 5xx are rolled back with their key row and never stored (ADR 0015); a concurrent duplicate waiting on the first request then executes the command itselfSELECT count(*) FROM idempotency_keys WHERE key = '<key>' is 0 after such a refusalRetry with the SAME key once the cause is fixed; no fresh key needed
429 rate-limited with Retry-AfterRATE_LIMIT_RPS is set and the per-process token bucket (burst = max(1, rps)) is emptyThe Retry-After headerBack off, or raise/unset the variable (0 = unlimited). The bucket is per pod, not shared
422 validation-failedMalformed JSON, unknown field, wrong type or a failed domain validationThe detail of the problemFix the request against apis/openapi.yaml
422 partial-acknowledgementThe acknowledgement did not cover every purchase order line with one decisionLine count of the orderSend one decision per line
422 ack-window-out-of-rangeThe vendor onboarding request asks for an acknowledgement window outside 1 h to 24 h (ackWindowMinutes 60 to 1440)Request bodyUse a value in range
404 node-not-owned-by-vendorThe node exists but belongs to another vendor, or the local node copy has not caught upSELECT * FROM vendor_nodes WHERE node_id = '<id>'Check the vendor id; if the node is new, wait for the NodeRegistered event to reach the node consumer
404 not-found on a purchase orderThe order was never released to this vendor: FulfillmentReleasedToNode has not been consumed, or it failedSELECT po_number, state FROM purchase_orders ORDER BY issued_at DESC LIMIT 5; consumer logsSee "Consumers" below
409 vendor-suspendedThe vendor account is suspendedSELECT state FROM vendor_accounts WHERE vendor_id = '<id>'Reinstate it with POST /vendors/{vendorId}/reinstatements (with an Idempotency-Key), then retry the refused write under the SAME key (the refusal is not stored); see use cases. Reads stay allowed while suspended
409 already-acknowledged, ack-window-closed, cancel-after-acknowledgement, label-before-acceptance, confirm-without-label, illegal-transitionThe purchase order is in a state that does not allow the command (domain invariants in internal/domain/purchaseorder)GET /vendor/purchase-orders/{poNumber} for its stateFollow the order lifecycle: acknowledge in full inside the window, then label, then confirm
409 concurrent-updateTwo writers raced on the same aggregate. The service already re-runs a unit once on a lost optimistic-concurrency checkA repeat of the requestRe-fetch and retry
409 submission-not-due / submission-already-processedInternal skip results of the submission processor; seen only when something calls the processor directlyNot expected on a vendor routeIgnore; the loop skips them
503 upstream-unavailable on POST /vendor/shipping-labels or GET /vendor/nodes/{nodeId}/scorecardThe synchronous neighbour (shipping-and-tracking, node-performance) timed out, was unreachable or answered 5xxSHIPPING_AND_TRACKING_URL / NODE_PERFORMANCE_URL; the neighbour's own healthFix or restore the neighbour, then retry; the label call is idempotent through the Idempotency-Key
502 upstream-refusedThe neighbour answered a 4xx; the adapter turns it into a refusal carrying the neighbour's problem slug (internal/adapters/outbound/httpclient/client.go). A call that exceeds the 5 s client timeout is upstream-unavailable insteadThe detailFix the request or the neighbour's rules

Asynchronous transactions​

Vendor writes for nodes, profiles and inventory (and acknowledgements and shipment confirmations) return a transactionId and are executed later by the submission processor (SUBMISSION_POLL_INTERVAL, default 1 s).

SymptomLikely causeCheckFix
A transaction stays PROCESSINGTX_PROCESSING_DELAY holds it; or its neighbour is down and the processor retries each pass; or the processor loop is failingSELECT transaction_id, kind, status, attempts, not_before FROM submissions WHERE status = 'PROCESSING'; loop pass failed with loop=submission processorRemove the delay knob; restore the neighbour. After 5 passes without an outcome (DefaultSubmissionMaxAttempts, not configurable by env) the transaction fails with ErrUpstreamUnavailable and vendor.submissions.processed{outcome=failed,reason=ErrUpstreamUnavailable} counts it. If last_refusal_code is set the neighbour is up and RELEASED a refusal (ADR 0016): SELECT transaction_id, attempts, last_refusal_code, last_refusal_message, last_refusal_path FROM submissions WHERE status = 'PROCESSING' AND last_refusal_code <> ''; fix what the refusal names (the node, region or listing it says is missing) and the next pass passes; otherwise the transaction fails with that same Err... code
Transactions fail with ErrSimulatedFailureTX_FAILURE_RATE is above 0 and the knob fires on purposePod envUnset it. It is a vendor-integration test knob, not an error
Transaction fails with ErrMalformedPayloadThe stored payload no longer decodes into the request typesubmissions.payloadResubmit with a valid body
processed submission found its order in another state; order left as is (WARN)The order moved on (cancelled or expired) between receipt and processingtransactionId, poNumber, state fields of the lineNothing; the submission completes and the order is left as is
Orders sit past ackBy without expiringThe expiry sweeper is not running or failing (EXPIRY_SWEEP_INTERVAL, default 30 s)loop running with loop=expiry sweeper at boot; loop pass failedFix the error shown; the pass is idempotent
submissions or idempotency_keys grow without boundThe 24 h retention sweeper is failing (processed submissions are purged after 30 days, idempotency keys after 24 h)loop pass failed with loop=retention sweeperFix the error shown

Consumers and the outbox​

SymptomLikely causeCheckFix
Reader retry logs only, no events appliedThe producer has not written yet, so its topic does not exist (the first writer auto-creates it)consumer running lines list topic and brokersBenign until the producer publishes
skipping a message that is not a valid CloudEvent (WARN)A record on the topic is not CloudEvents 1.0 JSON; it is committed pastconsumer, topic and error fieldsFix the producer; nothing is retried
A message type is ignored silentlyThe consumer dispatches on the full type string and has no handler for it (every other event on the shared topics, such as the rest of offer-availability's catalogue)The handler maps in internal/adapters/inbound/kafka/consumers.go and inbound_consumers.goExpected; see Integration for the types that are consumed
dead-lettering an event that can never be applied (WARN)The data of a handled type does not decode. The message goes to <topic>.dlq at once, without retriestype, event_id and error fields; the x-dlq-* headers on the DLQ recordFix the producer; replay only after reading processed_events (below)
<consumer> handling failed; retrying the same message (ERROR), then ... handling failed after the maximum attempts; dead-lettering the messageA transient failure (database down, unit of work rolled back): 200 ms doubling to 5 s, 5 attempts, then the DLQThe attempt, max_attempts, partition, offset fieldsRestore the database; the partition is blocked until the message is handled or dead-lettered, never dropped
... dead-letter publish failed; retrying the same message repeatsThe DLQ write fails (broker). A message that could not be dead-lettered is never skippedBroker healthRestore Kafka
Replaying a .dlq record applied twice, or not at allEffects are idempotent on the CloudEvents id in processed_events (claim and effect commit in one transaction), so a replay of an event whose first attempt rolled back applies; one that committed is skippedSELECT * FROM processed_events WHERE event_id = '<id>'Inspect before replaying
Events are not appearing on retailnetwork.vendor-connectivity.eventsRows are stuck in the outbox (published_at IS NULL): Kafka down, or the relay stoppedSELECT count(*), min(created_at) FROM outbox_events WHERE published_at IS NULL; outbox relay running at bootRestore Kafka; the backlog drains itself
ERROR outbox relay: row reached the attempt cap and is excluded from future claims; re-arm it with attempts = 0 after fixing the causeThe row failed OUTBOX_MAX_ATTEMPTS times (default 20). It is excluded from claims (attempts < $2); later rows are not blockedoutbox_id, topic, event_type, key, error fields; outbox_events.last_errorFix the cause, then UPDATE outbox_events SET attempts = 0 WHERE id = <id>

MCP and A2A​

SymptomLikely causeCheckFix
MCP client gets a tool error internal-error ("an unexpected internal error occurred")An unmapped failure inside a read use caserequest failed / ERROR next to the request log lineFix the cause; see the problem table above for the mapped errors (not-found, upstream-unavailable)
get_node_scorecard fails while every other tool worksIt relays from node-performance (NODE_PERFORMANCE_URL); the others read the local databaseNeighbour healthRestore node-performance
An MCP client cannot connect over stdio or SSEOnly Streamable HTTP is served, on /mcp and /MCP_ADDR (default :8090)Point the client at http://<host>:8090/mcp
A2A skill errors with a2a skill failed (ERROR)The underlying read failedThe error fieldSame as the matching REST read
A2A Agent Card lists the wrong URLA2A_AGENT_URL unset or wrongGET /.well-known/agent-card.jsonSet A2A_AGENT_URL to the externally reachable URL
Tracing is missing but logs are fineThe Collector is unreachable; export never blocks and errors surface only at DEBUGLOG_LEVEL=debug, line opentelemetry errorSee Observability