Skip to main content

Troubleshooting

Symptom, cause, check and fix, built from the failure modes visible in the code. Log messages are in Observability; procedures are in the Runbook.

Process and boot​

SymptomCauseCheckFix
Process exits right after start, log service exited with errordatabase unreachable or a migration failed after 5 attempts (about 15 s)the preceding WARN retrying lines name op (run migrations or ping postgres) and the errorfix connectivity, credentials or privileges (DDL needs a direct connection: set MIGRATIONS_DATABASE_URL), restart
Exits with unknown INVENTORY_MODE "x" (want kafka) (or the slotting / layout variant)a *_MODE value other than kafkathe environmentcorrect the value or unset it (the default is kafka)
Exits with INVENTORY_MODE=permissive is not supported: this context runs on real Kafka (or the slotting / layout variant)permissive was the old "do not start this consumer" mode and no longer existsthe environmentunset the variable or set kafka
Exits with INVENTORY_CONSUMER_GROUP is required: this context runs on real Kafka (or the slotting / layout variant)a consumer group variable is missingthe environmentset the group id (it must stay stable)
Exits with KAFKA_BROKERS is required: this context runs on real Kafkano brokers configuredKAFKA_BROKERSset it
Exits with DATABASE_URL is required: this context runs on real Postgresno database configured: there is no in-memory modeDATABASE_URLset it
Pod never becomes readythe listener starts only after the migrations and the first ping succeeded, and /readyz also needs Postgres and Kafka reachablethe log: no http server listening line means boot is still retrying; otherwise the /readyz body names the failing dependencysee the first row, or restore the database or broker
/readyz answers 503shutdown began (SIGTERM or SIGINT), or Postgres or the Kafka broker is unreachable (a missing topic never causes it)shutdown: readiness flipped... in the log, or the dependency named in the responsenone while the pod is terminating; otherwise restore the dependency

Events not flowing out​

SymptomCauseCheckFix
Nothing arrives on warehouse.pick-face-replenishment.eventsthe relay is off: no DATABASE_URL, or no KAFKA_BROKERSlog outbox relay off: ...set KAFKA_BROKERS and restart; the queued rows are sent
Unpublished rows keep growingbroker down or unreachable, or the first row is failingSELECT id, attempts, last_error FROM outbox_events WHERE published_at IS NULL ORDER BY id LIMIT 5; log outbox relay pass failedfix the broker; the relay retries every OUTBOX_RELAY_INTERVAL and keeps order
One row sits at attempts = OUTBOX_MAX_ATTEMPTS and later events overtook itthe attempt cap was reached (log row reached the attempt cap)the row's last_errorfix the cause, then UPDATE outbox_events SET attempts = 0 WHERE id = <id>
Events are published twiceat-least-once delivery after a crash between the ack and the UPDATEthe two messages carry the same CloudEvents idconsumers must dedupe on id (the fleet's do)

Events not flowing in​

SymptomCauseCheckFix
Local copies stay emptythe upstream context has not published yet, so its topic does not exist (the broker creates a topic on its producer's first write; the service never creates a consumed topic and /readyz does not wait for it)the kafka topics boot line, consumer running per consumer, ERROR kafka reader error; retrying naming the topic, and the consumer group's lag on the brokerwait for the producer to publish; a new group replays from the first offset
Consumer lag grows on one partitionthe same message keeps failing with a transient error and blocks the partition until the 5th attemptERROR handling failed; retrying the same message with partition, offset, attemptfix the database or dependency; after 5 attempts the message goes to the .dlq topic and the loop continues
Consumer lag grows and the log shows dead-letter publish failed or offset commit failedthe broker rejects the DLQ write or the commit; both retry forever and never skipthose ERROR linesrestore the broker, check ACLs and topic auto-creation for <topic>.dlq
Consumer not runningthe goroutine endedlog consumer stopped with errorrestart the process; there is no supervisor inside it
.dlq topics growpoison payloads: undecodable data, blank site, bin or SKU, negative levels, version below 1, an assignment without sku or slot, a SKU assigned twice in one map, a REPLENISHMENT relocation of quantity below 1read the dead letter's x-dlq-error headerfix the producer, republish (Runbook)
event processed shows "outcome":"duplicate"the CloudEvents id was already claimed (redelivery or a replay)processed_eventsexpected; to rebuild copies also clear the matching claims
"outcome":"stale"a bin level whose version is not above the stored one, or a SlotPlanApproved whose approved_at is not after the recorded onebin_stock_levels.version, forward_assignment_maps.approved_atexpected for late or replayed messages; nothing to fix
"outcome":"ignored" on a StockRelocatedreason is not REPLENISHMENT, source_ref is not a request id, the request is unknown, belongs to another site, or SKU / from bin / to bin do not match, or it is no longer openthe request and the relocation payloadexpected for other contexts' moves; for a real replenishment compare source_ref with the request id

Detection results​

SymptomCauseCheckFix
GET /pick-faces returns {"items":[]}no forward map applied for that siteId (forward_assignments empty), or every face is filtered out as decommissioned or as sitting in a known zone that is not in FORWARD_ZONE_CODESSELECT * FROM forward_assignments WHERE site_id = ...; the layout copyfeed the slotting consumer (SlotPlanApproved), check siteId spelling and the zone codes
A face is NO_POLICYno policy for that (site, SKU)GET /policies/{siteId}/{sku} is 404PUT /policies/{siteId}/{sku}
A face is NO_SOURCEthe level is low but no usable reserve stock: bin_stock_levels has no rows for the SKU (the inventory consumer is lagging or stopped, or no BinStockLevelChanged has reached it yet: inventory-storage publishes one per level change and has no backfill, so a bin that has not changed since the feed shipped is unknown until its next change, inventory-storage ADR 0040), the reserve bins' zones or locations have not arrived, their zone code is not in RESERVE_ZONE_CODES, their role is not Storage, usable stock (on_hand - reserved) is 0, or less than one multiple fitsSELECT * FROM bin_stock_levels WHERE sku = ..., locations, zonesfeed the missing copy, fix the zone codes or the policy multiple
A pick face is low and no request appearsan open request already counts as inbound (AlreadyOpen), or projected is above minQty (the rule is projected <= minQty), or need rounds down below one multipleGET /pick-faces shows openRequestId; GET /replenishments?state=Requestedwait for the request or cancel it
A request is URGENT although the shelf has stocka bin never seen reads as level 0 (ADR 0005), so a face whose level message has not arrived yet looks emptybin_stock_levels for the forward binexpected and accepted by the ADR; the next absolute level corrects the copy
A request stays Requested forevercompletion needs a StockRelocated with reason REPLENISHMENT and source_ref = the request id; inventory-storage produces it for a completed REPLENISH task (its ADR 0041) and fulfillment-execution runs that task (its ADR 0050), and wes-work-planning plans the task's work from ReplenishmentRequested (its ADR 0042), but only when its REPLENISHMENT_MODE=kafka consumer is on (the default permissive consumes nothing; warehouse-infra sets REPLENISHMENT_MODE=kafka on wes-work-planning), and it dead-letters the requests until the REPLENISH path is seeded in process-path-management (its ADR 0036), so no task existsIntegration; the .dlq topic of warehouse.pick-face-replenishment.events on the wes-work-planning sidecancel it, or seed the path (and check the wes-work-planning consumer is on)
Open requests were cancelled with ASSIGNMENT_CHANGEDa newer approved slot plan no longer assigns the SKU to that forward binthe request's cancelReasonexpected; the new face is evaluated in the same transaction

REST problem types​

StatusSlugCauseFix
400malformed-requestinvalid JSON, unknown field, trailing data, empty body, body over 64 KiBsend a valid body
400idempotency-key-requireda POST without Idempotency-Key (or over 128 characters) while running on Postgressend a unique key per logical request
400invalid-if-matchIf-Match is not a non-negative integer, or a DELETE without itsend the current policy version (the ETag)
400invalid-site-id, invalid-sku, invalid-request-idblank, over 64 characters, bad encoding, or a request id that does not start with repl-fix the identifier
400invalid-policyminQty/maxQty missing or not 0 <= min < max, or multiple below 1fix the bounds
400invalid-quantityquantity below 1send at least 1
400invalid-limit, invalid-cursor, unknown-query-parameter, invalid-state, invalid-statuslimit empty, repeated or outside 1 to 500, a repeated cursor, a query parameter the list does not declare, a cursor this API did not issue, an unknown state or status filteruse the documented values
404policy-not-found, replenishment-not-foundunknown keycheck the ids
409policy-already-existsPUT without If-Match on an existing policysend If-Match with the current version
409concurrent-modificationa stale If-Match, If-Match on a policy that does not exist, or a racing writere-read, retry
409replenishment-already-opena request is already open for that forward bin and SKU (also lost races of two sweeps: the partial unique index decides)read it with GET /replenishments?state=Requested, or cancel it
409replenishment-not-opencancelling a request that is already Completed or Cancellednone, it is final
409idempotency-key-reusedthe same key with a different method, path or body (a client bug: do not retry blindly; distinguishable from the business 409s by this type)use a new key
422no-forward-assignmentthe site's approved map assigns no forward bin to the SKUwait for or fix the slot plan
422no-policythe SKU has a forward bin but no policy declared at the site (with or without a quantity)declare a policy first
422no-source-stockno reserve bin has usable stock for the request (or the quantity exceeds the source's usable stock)check bin_stock_levels, send a smaller quantity
422nothing-to-replenishno quantity sent and the face is above its minimumsend a quantity, or leave it
422quantity-exceeds-maxprojected level plus quantity would pass maxQtysend a smaller quantity
500internal-erroran unmapped error, a recovered panic, or a database statement over the 5 s timeoutthe ERROR line request failed or handler panicked has the cause; the response never contains it

There is no 412 or 428 in this API (a missing or stale If-Match is 400 or 409), and no circuit breaker: the service makes no outbound HTTP or MCP call, so the only dependencies that can fail are Postgres and Kafka.

Idempotency-Key behaviour worth knowing​

  • Every problem type has one replay class (ADR 0014). A FINAL refusal (the request-shaped 400s, 404 replenishment-not-found, 409 replenishment-not-open) is stored and replayed for the same key and body. A RETRYABLE refusal (concurrent-modification, replenishment-already-open, no-forward-assignment, no-policy, no-source-stock, nothing-to-replenish, quantity-exceeds-max) is not stored: the key is released and the same key may be sent again once the cause changed (declare the policy, close the open request, let the stock arrive); a different body under a released key is a new request.
  • Every replay (a 2xx or a FINAL refusal answered from the store, or the winner's answer given to the loser of a race) carries the response header Idempotency-Replayed: true; the first execution never does.
  • A 5xx is never stored: the same key may retry the real work.
  • Under Postgres two concurrent requests with one new key both run, but the first to store wins and the other rolls back and replays the winner's answer.
  • The header is always enforced on the shipped binary (there is no in-memory mode); the in-memory test doubles used by unit tests ignore it.