Skip to main content

Troubleshooting

Symptom, cause, check, fix. Every row comes from a failure path in the code on develop (file named in the cause) or from a scenario tagged @known-bug in features/ (none is tagged today). Commands assume the kind cluster; replace <ns> with the apps namespace.

Quick checks first:

kubectl -n <ns> logs deploy/network-fulfillment | tail -50
curl -s http://localhost:8000/api/network-fulfillment/inbound-status
curl -s http://localhost:8000/api/network-fulfillment/network-orders

Boot and readiness​

SymptomCauseCheckFix
Pod restarts with exit code 143 while bootingThe kubelet killed a pod that had not started listening yet. Migrations and the DB ping run before the listener, and the first dial in an Istio pod is reset about 10 s after start (ADR 0011).kubectl describe pod: liveness/startup probe failures; logs show retrying op="run migrations"Keep the chart's startupProbe (60 s). Do not shorten it below the boot retry (15 s of waits plus attempt time).
Exit 1 with cannot wire order repositoryPostgres is unreachable or rejects the login after 5 attempts (cmd/netfulfil/database.go). There is no in-memory fallback (ADR 0025).The err field: connection refused, password authentication failed, ...Fix the DSN or the database. In kind, a role added to an already-initialised Postgres was never created: create it by hand as warehouse-infra's terraform/network-fulfillment.tf describes.
Several replicas crash-loop at the same time with pq: unnamed prepared statement does not exist or a statement timeout during migrationsMigrations run through PgBouncer in transaction mode, where golang-migrate's advisory lock does not hold (ADR 0007).Is MIGRATIONS_DATABASE_URL set in the pod? (optional: true in the chart, so a Secret without the key is silent.)Add a direct DSN under MIGRATIONS_DATABASE_URL in the database Secret.
Exit 1 with invalid configuration naming NETWORK_BASE_URL and/or NETWORK_VENDOR_IDNETWORK_MODE=live without them (one error names every missing one; cmd/netfulfil/config.go)The log's errorSet both, or use stub.
Exit 1 with cannot wire network gatewayNETWORK_MODE=live and the gateway refused its configuration (for example a malformed NETWORK_BASE_URL). internal/adapters/outbound/retailnetwork/client.goThe log's mode and errFix the value.
Exit 1 with cannot load network node definitionsNETWORK_NODES_FILE (live only) is unreadable, has an unknown key, a missing field, a lone lat/lon or a site listed twice (internal/adapters/outbound/retailnetwork/nodes.go)The err names the node and fieldFix the file or networkNodes.nodes.
WARN purchase order skipped, its node is not mapped to any of our sites (live)The network issued a purchase order for a node that is neither adopted nor registered for one of our sites. The order is read again only on the next boot and is otherwise expired by the network at ackBynodeId, poNumberPurchase orders that are skipped
WARN node profile: no cutoff schedule in the cache or no eligible path has a cycle time that fits the schedule / no capacity figure is known (live)the node profile is built only from what the local caches know, so the site is skipped (skipped_* on network_fulfillment.node_profile.declarations) and nothing is declared. The network keeps whatever profile it hadThe site and the reason in the lineThe node profile
ERROR the network failed a node profile declaration (live)the profile transaction failed; errors is the network's own listsite, revision, errorsThe node profile
Exit 1 with cannot load stub demandNETWORK_SEED_FILE unreadable, has an unknown key, a bad requiredShipBy, or is set while the gateway is not the stub (internal/adapters/outbound/retailnetwork/seed.go)The err names the field or demand indexFix the file or stubDemand.demands.
Exit 1 with cannot load product translationPRODUCT_TRANSLATION_FILE has an unknown key, an empty field, or the same networkProductId twice (internal/adapters/outbound/memory/translation_file.go)The err names the product indexFix the mapping.
Pod never Ready, logs stop after waiting for capability-offer caches to replay ..., then exit 1 with ... cache did not become ready within 1m0sa capability-offer cache could not replay its topic within the shared 120 s wait (cmd/netfulfil/capability.go). The listener, and so /readyz, starts only after that.Can the pod reach the first broker in KAFKA_BROKERS? The readiness target is read from it alone.Fix KAFKA_BROKERS or the broker.
Process panics non-positive interval for NewTicker right after startPOLL_INTERVAL or SWEEP_INTERVAL is 0 or negative. Those two parsers accept any valid duration (cmd/netfulfil/config.go).The env valuesUse a positive duration.
/readyz returns 503Only happens after SIGTERM: shutdown flips it first (internal/adapters/inbound/http/readiness.go).Is the pod terminating?Expected.
Exit 1 with ANALYTICS_DATABASE_URL is requiredprojector or reports started without the analytical DSNanalytics.database.existingSecret / urlSet it.

Network orders​

SymptomCauseCheckFix
Every order ends REJECTED, report shows ordersRejectedUntranslatableSku ≈ ordersReceivedNo product dictionary (empty productTranslation.mappings), or the product id is not in it. One unknown product rejects the whole order (ReceiveNetworkDemand.translate).Boot log no PRODUCT_TRANSLATION_FILE set ...; the order's lines via GET /network-orders/{ref} (an untranslatable order has none)Add the mapping and restart the pod (the file is read once at boot, see the runbook).
Orders stay NEW, /inbound-status failed grows, logs receive network demand failed ... raise held order: order-management POST /orders: status <n>order-management refused or failed the raise (n >= 300), or the breaker is open (next row). Nothing was held by a refused raise, so nothing is leaked. The poll finds the order still NEW inside its window and runs the raise again (ReceiveNetworkDemand resume); the raise carries the stable Idempotency-Key netful-raise-<networkRef>, so order-management replays the same order instead of reserving stock twice (internal/adapters/outbound/ordermanagement/planner.go).The status n and the slug in the error: released, a retry under the same key may pass is a refusal order-management does not store (unknown-process-path, line-ineligible-for-resolved-path, concurrent-modification: the next poll's retry can pass); final, a retry ... is answered the same is one it stores (a request it can never accept); order-management's own logs (ADR 0037)Fix order-management or its catalogue. The next poll answers the order, as long as its 24 h window is open; a raise that never passes ends rejected ACKNOWLEDGEMENT_DEADLINE_MISSED.
Live mode: a shipment stays PENDING in inbound_shipments with last_error inbound-receiving refused the ASN: <slug>, then turns REJECTED (still released after 30 attempts, giving up)inbound-receiving refused POST /asns with a problem it does NOT store (replay class RETRYABLE: unknown-sku, duplicate-sscc, concurrent-modification, ...). The same ASN number goes out again under the same Idempotency-Key nf-asn-<number> with backoff (one minute doubling to one hour) and passes once the state changes; the bound is 30 attempts, about 24 h (ADR 0037). A refusal it stores (asn-terminal, receipt-closed, a validation) or an unknown slug is REJECTED at the first answerSELECT shipment_ref, status, attempts, last_error FROM inbound_shipments; WARN inbound shipment not registered yet, retrying, ERROR inbound shipment rejected, it will not be retriedunknown-sku: declare the product in product-master; duplicate-sscc: cancel the other ASN; then re-arm per the runbook (attempts = 0).
Held orders reach order-management (and WES, fulfillment-execution, outbound-shipping) with no site; WARN network order site is not a site code; fulfillmentSiteId omittedThe network's site id (SITE_ID, for example site-1) is not a facility-layout site code, so ADR 0029 omits fulfillmentSiteId, and no NETWORK_SITE_MAP entry translates it (ADR 0035).The WARN's siteId; NETWORK_SITE_MAP on the Deployment (config.networkSiteMap); the order's request in order-management has no fulfillmentSiteIdSet NETWORK_SITE_MAP=<siteId>=<warehouse site> (for example site-1=AUS3) and roll the pod. Orders already held keep no site. A boot that exits with NETWORK_SITE_MAP: ... in the invalid configuration log has a map that is malformed: the message names the entry.
Stock stays reserved in order-management for a network order that was rejected, or never answeredThe hold leaked: the cancel failed, or the order stayed NEW past acknowledgeBy. Since ADR 0024 the hold id is recorded the moment it is raised and SweepOrphanedHolds cancels it once acknowledgeBy + ORPHAN_HOLD_GRACE has passed.The open-holds query in A held order is stuck in order-management; GET /network-orders/{ref} does not show the hold id of a NEW or REJECTED orderWait ORPHAN_HOLD_GRACE + SWEEP_INTERVAL after the window closes, or follow the runbook.
WARN orphaned holds swept repeats with failed > 0, counter network_fulfillment.orphaned_holds.swept{outcome="failed"} growsorder-management answered the cancel (DELETE /orders/{id}) with something other than 2xx, 404, 409 or 422, did not answer, or the breaker is open. The hold stays open and is retried every SWEEP_INTERVAL; the sweep logs counts, not the cause.GET /metrics: circuit_breaker_state{dependency="order-management"}; order-management logs for DELETE /orders/{localOrderId}Fix order-management; no action here. For one stubborn hold, cancel it there by hand.
An order is past acknowledgeBy + ORPHAN_HOLD_GRACE + SWEEP_INTERVAL, its hold is still held, and no orphaned holds swept line appearsThe sweep is not acting on it: switched off (boot WARN orphaned-hold sweep disabled by ORPHAN_HOLD_SWEEP_ENABLED), the order is SUBMITTED, ACKNOWLEDGED or CONFIRMED (never swept), or the row has no recorded id (a raise lost before it was recorded, or an order rejected before migration 0005).SELECT state, local_order_id, hold_outcome FROM network_orders WHERE network_ref = '<ref>';See the runbook's "Holds the sweep cannot see".
orphaned holds swept shows alreadyReleased > 0order-management answered the cancel with 409 or 422: the order had been released, so its stock is committed to the floor. Not an orphan: the outcome is recorded as ALREADY_RELEASED, no event is published and it is never retried.hold_outcome = 'ALREADY_RELEASED' on the rowDecide in order-management whether that order should ship.
failed grows with order-management: circuit breaker open, call not attemptedFive consecutive order-management failures (or >50 % of at least 10 calls in 30 s) opened the breaker (internal/resilience/breaker.go). No fallback: the call fails.GET /metrics: circuit_breaker_state{dependency="order-management"} 2Fix order-management. After 30 s one probe call is let through; success closes the breaker.
polls grows, received stays 0, since advancesThe network has nothing for us. In stub mode the gateway only returns what NETWORK_SEED_FILE seeded, and drops each unit once it is answered.networkMode in /inbound-status; boot log stub demand seededExpected. Seed more demand to test.
since absent minutes after startNo poll pass has fully succeeded: either PollDemand fails (poll demand failed) or at least one unit fails every pass.ERROR lines poll demand failed / receive network demand failedFix the failing unit or gateway; the watermark advances on the first clean pass.
Orders stuck in SUBMITTED after a pod restart (stub mode, Postgres on)The stub gateway records submissions in process memory. After a restart it answers PENDING for every earlier submission, and nothing else moves a SUBMITTED order: the sweeps and the overdue rejection only look at NEW (and the orphaned-hold sweep at NEW or REJECTED, never SUBMITTED, because the network is the only judge of its own record) (internal/adapters/outbound/retailnetwork/stub.go, reject_overdue_orders.go, networkorder/hold.go).list_network_orders with state=SUBMITTED; reconcile log pendingNo automatic recovery in stub mode. A live gateway would answer from the network's own record.
Order is ACKNOWLEDGED but the work never reached the floorReconcileSubmittedOrders.confirm commits ACKNOWLEDGED first, then calls POST /orders/{id}/releases. If that call fails, the error is dropped without a log line and the order is no longer SUBMITTED, so it is not retried. The orphaned-hold sweep never touches an ACKNOWLEDGED order (a cancel would break the commitment made to the network), so this is the residual hold of ADR 0024.order-management: the order with the network order's localOrderId is still held (allocated, not released)Release it in order-management: POST /orders/{localOrderId}/releases.
Many AcknowledgementDeadlineAtRisk events for the same orderBy design: the sweep re-publishes it on every pass while the order stays overdue and NEW.Consumers must treat it as level-triggered. RejectOverdueOrders rejects the order on its own ticker.

REST errors​

All errors are RFC 7807 application/problem+json with type https://errors.network-fulfillment.warehouse-systems.dev/<slug> (internal/adapters/inbound/http/errors.go).

Status and slugWhenFix
404 network-order-not-foundunknown networkRef on GET /network-orders/{networkRef} or the shipment confirmationcheck the ref (GET /network-orders lists only NEW ones; use the MCP list_network_orders for every state)
404 purchase-order-not-foundGET /purchase-orders/{poNumber}: no network order was received for that purchase-order number (ADR 0036). Never polled yet, or the poll that records it has not run; in NETWORK_MODE=stub every number is a 404, because nothing writes the number to networkRef map therecheck GET /inbound-status (polls, since) and retry; a stub run reads its demand by networkRef
400 invalid-purchase-order-number, unknown-query-parameterGET /purchase-orders/{poNumber} with a number that is not 1 to 128 characters of A-Z a-z 0-9 - . _ ~, or with any query parameter (it is a keyed read: no paging, no filter)fix the request; a number is sent as it was issued, unescaped
409 confirm-before-acknowledgePOST .../shipment-confirmation on an order that is not ACKNOWLEDGEDwait for reconciliation to settle it; REJECTED orders can never be confirmed. A load that already departed needs no call for a SUBMITTED order: the ShipmentConfirmed consumer recorded the shipment (log ... deferred) and ConfirmPendingShipments confirms it once the order is ACKNOWLEDGED
500 internal-error on shipment confirmationthe confirmation committed (CONFIRMED, event enqueued) but the gateway call failed afterwards (confirm_network_order_shipment.go)a retry returns 204 without calling the gateway again, because the order is already CONFIRMED; with a live gateway, re-submit out of band
422 unknown-product, empty-network-ref, empty-network-line-ref, empty-network-product-id, non-positive-quantity, order-without-linesmapped in errors.go. Only empty-network-ref is reachable: POST /network-orders//shipment-confirmation answers it (features/shipment_confirmation.feature). The others have no route today, because no route takes demand over HTTP.none needed
400 invalid-report-queryreports API: from/to missing or not RFC 3339, or granularity other than dayfix the query
500 report-store-errorreports API: the analytical database failedcheck the reports pod and ANALYTICS_DATABASE_URL

There is no 412 (no ETag/If-Match on any route) and no Idempotency-Key handling on this service's own routes.

Events, outbox and analytics​

SymptomCauseCheckFix
No events on warehouse.network-fulfillment.*The outbox relay is not draining (outbox_events rows pile up unsent) or the broker is unreachable (/readyz 503 dependency-unavailable naming kafka).SELECT count(*) FROM outbox_events WHERE sent_at IS NULL; relay ERROR logs; /readyzFix KAFKA_BROKERS or the broker.
Outbox backlog: outbox_events rows with published_at IS NULL grow, last_error setThe relay cannot send (broker down, auth, topic). It stops each pass at the first failing row to keep order, until that row reaches OUTBOX_MAX_ATTEMPTS (default 20; 0 = forever).SELECT id, topic, attempts, last_error FROM outbox_events WHERE published_at IS NULL ORDER BY id LIMIT 20; and WARN outbox relay: send failed, stopping this pass at the failed rowFix Kafka; the relay drains on its own.
ERROR outbox relay: row reached the attempt cap and is excluded from future claimsA row failed OUTBOX_MAX_ATTEMPTS sends (ADR 0021); later rows, including ones for the same networkRef, now overtake it and consumers never got it.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>; (runbook).
Analytics report emptyNothing reaches the analytics topic (row above), or the projector's consumer stopped.Projector log analytics consumer stopped; the process keeps answering /healthz 200 after thatRestart the projector pod.
warehouse.network-fulfillment.analytics.dlq growsNon-CloudEvents messages, or the projection failed 3 times (analytical DB down, statement timeout 10 s)DLQ headers x-dlq-error, projector WARN lines with phaseFix the cause, then replay as the runbook describes.
lagSeconds keeps growingNo event has been projected since that time: either nothing was published (quiet network) or the projector stoppedCompare with /inbound-status receivedOnly act when orders are arriving.
Report counts look low after an upgradeorders_rejected_submission_failed (migration 0002) is not back-filledRebuild the read model (runbook).

Capability offers​

SymptomCauseCheckFix
Every offer is PHYSICALNo CPT schedule cached for SITE_ID, or no capacity figure observed for any eligible path at that exact cutoffAt (recompute_capability_offers.go). Unknown capacity falls back to physical stock.Is SITE_ID the site process-path-management publishes CPTScheduleChanged for? Does wes-work-planning publish PathCapacityChanged for the same cutoff_at?Align SITE_ID; capacity is matched on the exact cutoff instant.
Offers THROUGHPUT_CONSTRAINED with quantity 0No cutoff within the next 7 days can be made: for every one, every eligible path's CycleTimeP95 exceeds the time left to it (ADR 0017, ADR 0031), which is a proven zero. A path that only misses the next cutoff does not zero the offer: it is computed against the next cutoff it can make.path cycle times on warehouse.process-path-management.events; the site's CPT scheduleNot expected with a weekly schedule: check for an overstated cycle_time_p95 or a schedule with almost no cutoffs.
Cutoffs look shifted by the site's UTC offsetThe schedule's timezone is unknown or missing, so its cutoffs are read as UTC (ADR 0031 §2).WARN the CPT schedule's timezone is unknown or missing with the site and the zone receivedPublish a valid IANA zone (e.g. America/Chicago) in CPTScheduleChanged.
SKU missing from the offersOnly SKUs in the product dictionary are recomputed, and a failed inventory-storage call skips that SKU for the pass.ERROR capability offer: usable inventory lookup failedFix INVENTORY_STORAGE_URL or inventory-storage.

MCP​

SymptomCauseFix
get_acknowledgement_report not in tools/listREPORTS_BASE_URL unset (the chart sets it only with analytics.enabled or mcp.reportsBaseUrl)set one of them
Tools return no orders while the API has somethe mcp pod points at a different database than the APIgive it the OLTP Secret (database.existingSecret)
session not found style errors with more than one mcp replicasessions live in one pod's memory and the Service has no affinitykeep mcp.replicaCount: 1