Troubleshooting
Each row is a failure mode that the code on develop can actually
produce. The checks use the log messages, problem types and metrics
listed in Observability; the settings are in
Configuration.
Startup log lines
cmd/order logs one line per optional integration at boot. On a pod that
does not behave as expected, read these first: they tell you which
integrations are switched off.
| Level | Message | Meaning |
|---|---|---|
| INFO | database url not configured; using in-memory adapters | No DATABASE_URL: data is lost on restart, and there is no idempotency middleware, no outbox and no sweeper. |
| WARN | inventory-storage client in permissive (no-op) mode; allocation will refuse to run | INVENTORY_STORAGE_MODE is not http. |
| WARN | product classification lookup in permissive (fail-open) mode; … | PRODUCT_CLASSIFICATION_MODE is not kafka. |
| WARN | process-path catalogue source not configured; ReceiveOrder will skip path validation, … | PATH_CATALOGUE_SOURCE is not kafka; promises use the lead-time fallback. |
| INFO | site/SKU demand projection disabled | DEMAND_PROJECTION_SITE_ID unset. It is logged twice because two call sites build the policy. |
| INFO | planned capacity integration disabled | PLANNED_CAPACITY_CONSUMER_GROUP unset. |
| WARN | KAFKA_BROKERS not configured; RepromiseOrder consumer will not run, OrderRepromised will never fire | No broker list. |
| INFO | event publisher configured (transactional outbox) | Postgres plus EVENT_PUBLISHER=kafka: the relay will run. |
| INFO | repromise consumer configured | topic, group_id of the re-promise consumer. |
| INFO | release confirmation consumer configured | topic, group_id, timeout of the release-confirmation consumer (ADR 0043). Only logged with RELEASE_CONFIRMATION_MODE=kafka; its absence means the loop is off, which is the default. |
| INFO | housekeeping sweeper started | The sweeper's settings. release_confirmation_sweep=true means the release-confirmation timeout is armed; false means the loop is off or RELEASE_CONFIRMATION_TIMEOUT is 0. |
| INFO | http server listening | Boot finished; the probes can now pass. |
Boot and readiness
| Symptom | Cause | Check | Fix |
|---|---|---|---|
Pod exits at once with invalid product classification configuration: PRODUCT_CLASSIFICATION_MODE=http was removed by ADR 0036 … | A deployment still sets the removed http mode. | kubectl logs of the failed container. | Set PRODUCT_CLASSIFICATION_MODE=kafka with PRODUCT_CLASSIFICATION_CONSUMER_GROUP, or permissive. |
Exit with … PRODUCT_CLASSIFICATION_MODE=kafka requires PRODUCT_CLASSIFICATION_CONSUMER_GROUP … or … requires KAFKA_BROKERS | kafka mode without its group or brokers. | Container env. | Set both. The chart renders KAFKA_BROKERS when productClassification.consumerGroup is set. |
Exit with PATH_CATALOGUE_SOURCE=kafka requires KAFKA_BROKERS to be set | Catalogue enabled through extraEnv while the chart did not render KAFKA_BROKERS (it only does for eventPublisher=kafka or a consumer group). | Rendered Deployment env. | Add KAFKA_BROKERS to extraEnv or enable one of the conditions. |
Exit with invalid release confirmation configuration: … (unknown RELEASE_CONFIRMATION_MODE "x" (want kafka or off), or RELEASE_CONFIRMATION_MODE=kafka requires RELEASE_CONFIRMATION_CONSUMER_GROUP, … requires KAFKA_BROKERS, … requires DATABASE_URL, … requires EVENT_PUBLISHER=kafka) | The release-confirmation loop (ADR 0043) is switched on without one of its prerequisites, or the mode is misspelt. | Container env; the message names the missing variable. | Set it, or leave releaseConfirmation.mode empty (RELEASE_CONFIRMATION_MODE=off, the default). In the chart set releaseConfirmation.mode=kafka together with config.eventPublisher=kafka and a database; the chart renders the group and KAFKA_BROKERS. |
Exit with invalid outbound shipping consumer configuration: … (unknown OUTBOUND_SHIPPING_CONSUMER_MODE "x" (want kafka or off), or OUTBOUND_SHIPPING_CONSUMER_MODE=kafka requires OUTBOUND_SHIPPING_CONSUMER_GROUP, … requires KAFKA_BROKERS, … requires DATABASE_URL) | The outbound-shipping consumer (ADR 0051) is switched on without one of its prerequisites, or the mode is misspelt. | Container env; the message names the missing variable. | Set it, or leave OUTBOUND_SHIPPING_CONSUMER_MODE unset (off). |
Orders stay Released after their load departed | The outbound-shipping consumer is off (the default, and the chart and warehouse-infra do not set it), or the event named an order this service does not know or one with no Released line (WARN shipment confirmation names …, skipping). | OUTBOUND_SHIPPING_CONSUMER_MODE in the container env; the WARN lines; the lag of OUTBOUND_SHIPPING_CONSUMER_GROUP on warehouse.outbound-shipping.events. | Enable the consumer (runbook, "Turn the outbound-shipping consumer on or off"). A skipped order is not retried. |
Exit with process-path catalogue did not become ready within 1m0s (or the CPT-schedule or path-capacity variant) | The cache could not replay its topic in 60 s: broker unreachable, or a very large topic. | Broker health; the offsets of warehouse.process-path-management.events and warehouse.work-planning.events. | Fix broker reachability. Each boot replays the whole topic, so very long retention slows boot. |
Exit with run migrations (after 5 attempts): … or ping database (after 5 attempts): … | Postgres unreachable or rejecting the credentials for longer than the boot retry budget (5 attempts, about 15 s of backoff). | The last error in the message (it is the real one, for example password authentication failed). | Fix the DSN or the database. One or two retrying lines in the first ~10 s are normal: the Istio sidecar resets the first dial. |
Pods crash-loop with pq: unnamed prepared statement does not exist or canceling statement due to statement timeout during migrations | Migrations go through PgBouncer in transaction-pooling mode, where golang-migrate's advisory lock does not hold (ADR 0029). | Is MIGRATIONS_DATABASE_URL set, and is it a direct DSN? | Provision the direct DSN under the Secret key MIGRATIONS_DATABASE_URL. |
Exit with Dirty database version N. Fix and force version. | A previous migration failed half-way; golang-migrate refuses to continue. | SELECT * FROM schema_migrations; | Repair the schema by hand, then migrate force <N> against the direct DSN. The binary does not force. |
| Pod never becomes Ready; startup probe kills it after 60 s | Boot work (retries plus cache replay) exceeds 60 s. The listener only opens after boot. | Last log line before the kill: waiting for … to replay or retrying. | Fix the dependency. Raise startupProbe.failureThreshold only if boot is legitimately slower. |
| Requests keep reaching a terminating pod | warehouse-infra overrides readinessProbe to /healthz, which never flips. | kubectl get deploy order-management -o yaml and look at readinessProbe.httpGet.path. | Use the chart's /readyz default. |
cmd/order-projector or cmd/order-reports exits with ANALYTICS_DATABASE_URL is required | Analytics enabled without a DSN. | analytics.database.* values or the analytics Secret. | Provide the DSN, or keep analytics.enabled=false. |
REST problem types
Every error is application/problem+json with
type = https://errors.order-management.warehouse-systems.dev/<slug>.
There is no 412: the API has no If-Match/ETag precondition.
Optimistic concurrency surfaces as 409 concurrent-modification.
| Status | Slug | Cause | Fix |
|---|---|---|---|
| 400 | malformed-request-body | Body is not valid JSON. | Fix the client. |
| 400 | order-without-lines, empty-sku, empty-order-id, empty-path-id, order-line-not-found | Validation in the adapter or domain. | Fix the request. |
| 400 | unknown-process-path | Retry with the same key once the catalogue has the path (not stored, ADR 0054). The path chosen for a line is not active in the process-path catalogue (PATH_CATALOGUE_SOURCE=kafka). When no active path declares CUSTOMER_ORDER in its intake, selection falls back to pick, so this also fires if pick itself is not in the catalogue (ADR 0042). | Check process-path-management's catalogue for a deactivated path, and that its declared catalogue was seeded (GET /process-paths shows intake: ["CUSTOMER_ORDER"] on PICK). |
| 400 | idempotency-key-required | POST /orders without Idempotency-Key while DATABASE_URL is set. | Send a fresh key per new order. The operator MFE sends one per submission (ADR 0038) and CORS allows the header; if the MFE still gets this, it is running an old web/ build. |
| 400 | invalid-query-parameter | GET /planned-capacity without site, or with a from that is not RFC 3339. | Fix the query. |
| 404 | order-not-found | Unknown id. In-memory mode loses every order on restart. | Check the id and DATABASE_URL. |
| 404 (no problem body) | n/a | GET /planned-capacity while PLANNED_CAPACITY_CONSUMER_GROUP is unset: the route is not registered. | Set the group. |
| 409 | order-already-released | Cancel after any line was released or shipped (BR6). | Expected; v1 has no claw-back (ADR 0004). |
| 409 | no-backordered-lines, no-allocated-lines, promise-date-not-set, order-not-held, order-line-already-allocated, order-line-not-pending, order-line-not-backordered, order-line-not-allocated | The order is not in the state the command needs: for example retry-allocation on an order with nothing backordered, or release on an order that was not held. | Read the order first (GET /orders/{id}). |
| 409 | idempotency-key-reused | Same Idempotency-Key with a different method, path or body (was 422 before ADR 0048). | Use a new key for a different request. |
| 409 | concurrent-modification | Another writer (an HTTP call or the re-promise consumer) saved the order first; the version column check failed (ADR 0024). | Re-read and retry with the same key: the refusal is not stored (ADR 0054). |
| 422 | non-positive-quantity, line-ineligible-for-resolved-path | Line validation; no eligible path for the line's attributes. | Fix the line, or check the product classification copy. |
| 422 | held-order-must-be-ship-complete | releaseOnAllocation: false with allowPartialShipment: true. | Send one or the other (ADR 0020). |
| 503 | downstream-not-configured | INVENTORY_STORAGE_MODE is permissive. POST /orders still answers 201 with the order Received and its lines Pending; commands that must call inventory-storage answer 503. | Set INVENTORY_STORAGE_MODE=http and INVENTORY_STORAGE_BASE_URL. |
| 503 | downstream-unavailable | inventory-storage timed out (5 s), answered 5xx or an unexpected status, or the circuit breaker is open. | See circuit breaker. |
| 503 | insufficient-stock | ports.ErrInsufficientStock reached the adapter as an error rather than becoming a backorder. | Retry later. |
| 500 | internal-error | Unmapped error (database, encoding). | Read the detail and the ERROR log for the same request_id. |
Idempotency-Key behaviour
- The middleware wraps every
POST(/orders,/orders/{id}/releases,/orders/{id}/allocation-retries), and only whenDATABASE_URLis set. - The key and a SHA-256 of the body are stored in
idempotency_keysin the same transaction as the order and its outbox rows. - A retry with the same key and body replays the stored status and body
(
Idempotency-Replayed: true) only when the first answer is final for the request (ADR 0054): a 2xx, or a refusal that is a function of the request (FINAL, e.g.422 non-positive-quantity,404 order-not-found). - A refusal that depends on state that can change (
RETRYABLE:concurrent-modification,unknown-process-path,line-ineligible-for-resolved-path,order-not-held,no-backordered-linesand the other state refusals) and every 5xx or panic are not stored: the key row is rolled back with the rest of the request, a retry under the same key executes again, and a different body under that key is a new request. Do not mint a new key to retry them. A refusal that declares no class is released the same way. The class of every problem type is the table in ADR 0054 (replay_class_test.goholds it equal to the catalogue). - Keys expire after
IDEMPOTENCY_KEY_TTL(24 h). After that the same key creates a new order. - A panic inside the handler rolls back and caches nothing.
Circuit breaker and allocation
| Symptom | Cause | Check | Fix |
|---|---|---|---|
Every allocation fails with 503 downstream-unavailable | Breaker open: 5 consecutive failures, or more than half of at least 10 requests failed within 30 s. It stays open 30 s, then lets one probe through. | circuit_breaker_state{dependency="inventory-storage"} = 2; inventory-storage health. | Fix inventory-storage. The breaker closes after one successful probe. Calls are never retried, because reservations are writes. |
Orders stay Received with Pending lines | Permissive inventory client, or the implicit allocation at intake hit a hard failure. POST /orders answers 201 either way. | Startup WARN; the status of the lines. | Configure http mode first. No endpoint re-runs allocation for Pending lines: retry-allocation only takes Backordered lines and answers 409 no-backordered-lines (observed on a local run). Cancel the order (DELETE /orders/{id} answers 204 while nothing is released) and submit it again with a new Idempotency-Key. |
Lines Backordered | inventory-storage answered 409 (no usable stock). This is a business fact, not an error (BR2). | The order response. | POST /orders/{id}/allocation-retries once stock exists. |
Promise always LeadTime, never a CPT window | Catalogue caches not enabled, or the order's site has no CPT schedule (its fulfillmentSiteId, else DEFAULT_SITE_ID; ADR 0047). | Startup WARN; the order's fulfillmentSiteId; DEFAULT_SITE_ID. | PATH_CATALOGUE_SOURCE=kafka; check process-path-management publishes CPTScheduleChanged for that site. |
capacityConstraint never appears on orders | No published shortage window overlaps the promise at the order's site (its fulfillmentSiteId, else PLANNED_CAPACITY_SITE_ID), or the site code differs from warehouse-planning's location. | GET /planned-capacity?site=<code>. | Align PLANNED_CAPACITY_SITE_ID (the fleet uses SIM1) or the caller's fulfillmentSiteId. |
Kafka, DLQ and outbox
| Symptom | Cause | Check | Fix |
|---|---|---|---|
order_outbox_lag_seconds keeps growing | The relay cannot send the oldest row. It stops the pass at the first failure, so every later row waits. | SELECT id, topic, attempts, last_error FROM outbox_events WHERE published_at IS NULL ORDER BY id LIMIT 5; and the outbox relay pass failed ERROR log. | Fix the cause in last_error. See the runbook. |
outbox relay: row reached the attempt cap and is no longer claimed (ERROR) | One outbox row failed OUTBOX_MAX_ATTEMPTS times (default 20, ADR 0040). The relay parked it so later rows keep publishing; order_outbox_lag_seconds keeps growing because the parked row is still the oldest unpublished one. | SELECT id, topic, event_type, key, attempts, last_error FROM outbox_events WHERE published_at IS NULL AND attempts >= 20; | Fix the cause in last_error, then UPDATE outbox_events SET attempts = 0 WHERE id = .... See the runbook. |
| wes-work-planning never sees releases | EVENT_PUBLISHER=log: events are only logged. | Startup log; domain event published lines. | config.eventPublisher=kafka. |
OrderRepromised never published | KAFKA_BROKERS unset (the consumer does not start), or no TaskCPTMissed/PackageManifested arrives. | Startup WARN; lag of group order-management-repromise. | Set KAFKA_BROKERS. |
Consumer lag on order-management-repromise grows | Handling is slow or retrying: each failed message takes up to 3 attempts, and a broker outage makes the consumer back off without limit. | repromise: kafka unavailable, retrying logs; broker health. | Fix the dependency. Add replicas: the group is shared. |
Messages in warehouse.fulfillment.events.dlq | Not a CloudEvent, or handling still failed after 3 attempts (including repeated concurrent-modification). | x-dlq-error header; repromise: … sending to dead-letter topic logs with ce_id. | Fix the cause and replay (see the runbook). |
Messages in warehouse.warehouse-planning.events.dlq | A capacity-plan event could not be decoded or applied. | x-dlq-error header. | Fix and replay. |
ERROR release unconfirmed, or order_release_confirmation_unconfirmed_total increasing | A released order line got no WorkUnitCreated from wes-work-planning within RELEASE_CONFIRMATION_TIMEOUT (ADR 0043). A signal, not proof. | SELECT order_id, line_no, released_at FROM release_confirmations WHERE state = 'UNCONFIRMED'; | Follow the runbook procedure. Nothing is cancelled or retried automatically; a late confirmation clears the row. |
Every released line is flagged UNCONFIRMED soon after the loop was enabled | wes-work-planning does not stamp reference/line_no on WorkUnitCreated yet (its ADR 0041), so each event is ignored. | order_release_confirmation_events_total{outcome="ignored_no_reference"} climbing and confirmed flat. | Switch RELEASE_CONFIRMATION_MODE back to off until that producer change is deployed. |
Lines are flagged much later than RELEASE_CONFIRMATION_TIMEOUT | The timeout rides the housekeeping sweep, so a line is flagged on the first pass after it: up to 1h15m at the default HOUSEKEEPING_INTERVAL of 1h. | housekeeping sweeper started log: interval. | Set HOUSEKEEPING_INTERVAL to about 5m. |
| Work is missing on the floor but nothing is ever flagged | The loop is off (the default), RELEASE_CONFIRMATION_TIMEOUT is 0, HOUSEKEEPING_INTERVAL is 0, or the lines were released before the loop was enabled (no row, no backfill). | Startup lines release confirmation consumer configured and housekeeping sweeper started (release_confirmation_sweep); SELECT count(*) FROM release_confirmations; | Enable the loop (see the runbook); older lines are not covered. |
Messages in warehouse.work-planning.events.dlq | A WorkUnitCreated that is not a CloudEvent, whose data cannot be decoded, or that still failed after 3 attempts. It will not confirm its line. | x-dlq-error header; release confirmation: … sending to dead-letter topic WARN logs. | Fix the cause and replay (see the runbook). An event without reference/line_no is not dead-lettered, it is counted as ignored. |
| A consumer stops consuming | The DLQ write or the offset commit failed. That is the one error that ends a consumer loop, so that nothing is skipped silently. For the re-promise consumer the error ends the whole cmd/order process (it exits 1 and Kubernetes restarts it); the planned-capacity and classification consumers log planned capacity consumer stopped / product classification consumer stopped and the process keeps serving HTTP without them. | Pod restarts; those ERROR lines. | Restore broker access. Restart the pod for the two consumers that do not restart on their own. The release-confirmation consumer does not end this way: it retries the same message with backoff until the DLQ write or commit succeeds. |
| Product classification copy stays empty | Mode permissive, wrong group, or product-master publishes nothing. | Startup log product classification consumer configured; SELECT count(*) FROM product_classification_copy; | Fix the mode or group. Invalid messages are logged at WARN and skipped, not dead-lettered. |
| Report numbers lag | Projector down or slow. | GET /reports/funnel/freshness; lag of group order-management-analytics. | Restart the projector. Processing is idempotent on the event id. |
GET /reports/funnel answers 500 report-store-error | A query took longer than the 15 s statement_timeout, or the database is unreachable. | detail of the problem. | Narrow from/to or add pathId. |
MCP
| Symptom | Cause | Check | Fix |
|---|---|---|---|
get_promise_health always returns zeros | ANALYTICS_DATABASE_URL is not set on the MCP container. The chart never renders it. | Startup log analytics database url not configured; get_promise_health will report empty KPIs. | Add it through mcp.extraEnv. |
get_order answers order not found for an order that exists | The MCP pod has no DATABASE_URL and uses an empty in-memory repository. | Startup log database url not configured; using in-memory adapters. | Point it at the OLTP database. |
Session errors after initialize | More than one MCP replica: sessions live in process memory and the Service has no affinity. | kubectl get deploy order-management-mcp. | Keep one replica. |