Skip to main content

Troubleshooting

Symptom → cause → check → fix​

SymptomLikely causeCheckFix
API pod never becomes ready; startup probe fails after 60sA migration failed or Postgres is unreachable: the server only listens after RunMigrations and the ping succeed.Pod logs: run migrations: ..., open postgres pool: ... or ping postgres: ...; the process exits.Fix the DSN or the migration. Behind PgBouncer set MIGRATIONS_DATABASE_URL to a direct DSN (ADR 0006).
API exits at boot with PLANNING_MAX_STALENESS must be a positive durationUnparsable or non-positive value.kubectl get deploy -o yaml env.Use a Go duration such as 10m.
nip-projector CrashLoopBackOff with ANALYTICS_DATABASE_URL is required / KAFKA_BROKERS is requiredRequired variable missing.Pod env / the analytics Secret.Set analytics.database.* and kafka.enabled.
nip-projector or nip-reports exits about 15s after its first dial at bootThe database is genuinely unreachable (boot retry exhausted: 5 attempts, 1+2+4+8 = 15s of backoff, plus the time each failed dial takes).Log ... (after 5 attempts): ....Fix the DSN or network; a single early reset is retried automatically.
GET /v1/transfer-simulations → 503 read-models-unavailableThe API runs without DATABASE_URL.Startup log DATABASE_URL unset.Configure the database.
GET /v1/transfer-simulations → 503 read-models-incompleteBuildSnapshot refused: an empty table, a fact older than PLANNING_MAX_STALENESS, no site with all three facts, or a participating site disabled for a direction.The problem detail names the reason (for example stale site capability for WH1). SELECT site_id, as_of FROM site_capability; and the same for site_sku_demand / published_capacity_plan.Check the three consumers run (their group ids are set) and the upstream contexts publish; a disabled site must be re-enabled upstream (any disabled participating site refuses the whole snapshot).
Read models never changeThe consumer's group variable is empty, KAFKA_BROKERS is unset, or the consumer is blocked on one message.Boot log consumer disabled name=...; ERROR lines ... handling failed; retrying the same message with partition/offset; consumer lag.Set the group id; fix the transient cause (usually the database). Deterministic problems are skipped at WARN, so a blocked partition always has an ERROR line.
POST /v1/transfer-approvals → 503 saga-unavailableNo DATABASE_URL, or no KAFKA_BROKERS (no outbox writer).Boot WARN KAFKA_BROKERS not configured.Configure both.
Approval → 503 config-incompleteTRANSFER_PICK_PATH_ID unset or the pick CPT offset not positive (ADR 0005).Boot WARN work release not configured.Set config.transferPickPathId.
Approval → 422 facts-incompleteThe current snapshot refuses (stale or missing facts), a site is missing or not enabled for its direction, the destination shows no in-window demand for the SKU, or the origin capacity cannot cover its own demand plus the quantity.detail names the rule.Refresh the facts or pick another pair; the approval re-validates against current facts by design.
Approval → 422 invalid-approvalA missing field, non-positive quantity, origin = destination, missing proposalAsOf or empty policy version.detail.Fix the request.
Approval → 422 proposal-expiredThe 24h expiry computed at approval is not after "now" (clock problem).Server clock.—
Approval → 409 idempotency-key-reusedThe Idempotency-Key was used before with a different origin, destination, SKU, quantity, policy version, proposalAsOf or operator reason (the fingerprint is method + path + SHA-256 of the whole body).SELECT transfer_id, idempotency_key FROM inter_warehouse_transfer WHERE idempotency_key = '<key>';Send a fresh key per logical approval. A replay with the byte-identical body answers the stored 200 with the header Idempotency-Replayed: true.
Approval → 400 idempotency-key-requiredHeader missing.—Send Idempotency-Key.
Approval → 503 approval-unavailableAny other failure: reading the read models or writing the transaction.API logs, Postgres health.Retry with the same key once the database is healthy.
Transfer stays ALLOCATINGinventory-storage never replied, the relay is off, or TRANSFER_REPLY_CONSUMER_GROUP is empty.outbox_events row for TransferAllocationRequested has published_at? Reply consumer running? find_stuck_transfers with state=ALLOCATING.Enable the relay / consumer; check inventory-storage's allocation consumer. The health check flags it after 1h.
Transfer UNFULFILLABLEinventory-storage rejected: ORIGIN_SITE_UNKNOWN, INSUFFICIENT_USABLE or IDEMPOTENCY_CONFLICT.rejectionReason on GET /v1/transfers/{id}.Terminal; approve a new transfer if appropriate.
Transfer stays ALLOCATEDNo TransferPicked from fulfillment-execution: the pick WorkDemandReleased was not consumed by wes-work-planning, or TRANSFER_FACT_CONSUMER_GROUP is empty.outbox_events for WorkDemandReleased (key <transferId>:pick); fact consumer boot log.Check WES knows TRANSFER_PICK_PATH_ID; enable the fact consumer.
Transfer stays PICKED, no dispatch workTRANSFER_DISPATCH_PATH_ID (or its offset) is not configured: the PICKED transition commits, the dispatch demand is withheld and the fact is skipped.WARN on the fact consumer; no <transferId>:dispatch row in outbox_events.Configure the dispatch path. There is no automatic re-release; the missing demand has to be re-issued by hand (re-publishing is not possible because the row was never written).
Transfer stays IN_TRANSITNeither TransferArrived nor inventory-storage's TransferReceiptStaged arrived.Reply and fact consumers' WARN/ERROR lines.Check the destination receiving flow.
A fact is ignoredIt was a replay, out of order, or for an unknown transfer_ref. A fact that failed the aggregate's checks (wrong line, site, SKU, quantity) is dead-lettered instead (row below).WARN skipping deterministic ... with transfer_id.Expected for replays; otherwise check the producer.
A transfer reply or fact lands on warehouse.inventory.events.dlq / warehouse.fulfillment.events.dlqThe message could never apply: a malformed payload, or one the aggregate refuses (ErrReplyRefused: other line id, origin, SKU, allocation total, no reservation id or expiry, unknown rejection reason; ErrFactRefused: impossible quantity, foreign line, wrong site/SKU). It was dead-lettered and committed past (ADR 0013); the partition keeps flowing and the transfer keeps its state.ERROR transfer-reply-consumer: dead-lettering a message that can never be applied (or transfer-fact-consumer: ...) with error, dlq_topic, partition, offset; DLQ headers x-dlq-consumer, x-dlq-error.Fix the producer's payload. See "Drain a transfer DLQ" in the Runbook.
outbox_events backlog growsRelay disabled (OUTBOX_RELAY_ENABLED empty), broker unreachable, or one row failing (head-of-line).SELECT id, attempts, last_error FROM outbox_events WHERE published_at IS NULL ORDER BY id LIMIT 5;Fix the cause of last_error; the next 1s tick retries.
ERROR outbox relay: row reached the attempt cap and is excluded from future claims; one event never reaches Kafka while later ones doThat row failed OUTBOX_MAX_ATTEMPTS sends (default 20): a poison message or a long broker outage (ADR 0016).SELECT id, topic, event_type, key, 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 DLQ growsA saga-health event with an unusable payload, or one the projection rejects.Message headers x-dlq-error, x-dlq-source-topic.Fix the producer or projection, then re-produce the message.
Reports are staleProjector down, lagging or blocked on a transient database error.GET /reports/freshness lag_seconds; projector /readyz; consumer lag of network-inventory-planning-analytics.Restore the analytical database; the projector resumes from its committed offset.
Funnel report misses a stateThe relay is off, or the analytics projector lags. Every transition (approval trail, ALLOCATED, PICKED, IN_TRANSIT, ARRIVED, RECEIVED, UNFULFILLABLE) writes one TransferStateAdvanced outbox row in the transition's transaction.SELECT event_type, count(*) FROM outbox_events WHERE event_type LIKE '%TransferStateAdvanced' AND published_at IS NULL GROUP BY 1; then SELECT to_state, count(*) FROM transfer_state_advances GROUP BY 1;Enable the relay; check projector lag.
GET /v1/rebalance-runs is emptyNIP_REBALANCE_SCHEDULE is unset (the default) or there is no outbox.Boot log scheduled rebalance disabled.Set the schedule.
Scheduled runs are COMPLETED but proposalCount is always 0The catalogues are empty, no lane is Enabled, an origin has no policy for the SKU, the destination's in-window demand is 0, or the origin's headroom minus its safety stock is ≤ 0 (ADR 0015).GET /v1/rebalance-policies, GET /v1/transfer-lanes, GET /v1/transfer-simulations (capacityHeadroom, totalDemand). A positive rejectedCount means candidates cost more than their priority benefit.Add the policies at BOTH ends of a lane and enable the lane; raise the destination's UnitPriority or lower the lane's UnitHandlingCost.
A catalogue PUT answers 412 version-mismatchThe If-Match revision is not the entry's current one (someone else changed it), or the entry does not exist yet.GET the catalogue and read the entry's revision.Re-apply the change with the current revision, or omit If-Match for a last-writer-wins PUT.
TransferStuckDetected repeats for the same transferExpected: every tick re-reports every transfer still over its threshold, and every API replica runs its own ticker.—Deduplicate downstream by transfer_id.
Health check never firesNIP_HEALTH_CHECK_INTERVAL=0, an invalid NIP_STUCK_THRESHOLDS, or no outbox.Boot log saga health check disabled / invalid stuck thresholds.Fix the value; an unknown state name disables the whole check.
MCP tool returns read-side-unavailablecmd/mcp runs without DATABASE_URL.MCP boot log.Configure the database.

There is no circuit breaker and no 412 anywhere in this service: NIP makes no outbound HTTP calls and uses no ETags.

Problem types​

Every REST error is application/problem+json with type = https://warehouse.example/problems/<slug> (internal/adapters/inbound/http/problems.go, transfers_read.go, reports_handler.go). Every slug carries a replay class (ADR-0024): a FINAL refusal is stored under its Idempotency-Key and replayed on retry; a RETRYABLE one (marked R below: facts-incomplete, below-one-case, transfer-not-found, version-mismatch, concurrent-modification, and every 5xx) is NOT stored — the key is released and a retry under the same key executes again, so check the live state instead of expecting a replay.

SlugStatusRoute(s)
invalid-request400POST /v1/transfer-proposal-runs, POST /v1/transfer-approvals, catalogue PUTs (malformed JSON or unknown field)
invalid-planning-snapshot422generate (missing asOf, mixed position snapshot)
read-models-unavailable503GET /v1/transfer-simulations
read-models-incomplete503GET /v1/transfer-simulations
saga-unavailable503approve
idempotency-key-required400approve
idempotency-key-reused409approve
config-incomplete503approve
invalid-approval422approve (FINAL: replays from the store)
facts-incomplete422approve (R: not stored — after the facts arrive, retry the SAME key)
proposal-expired422approve
below-one-case422approve (R: the origin's headroom can recover)
pack-levels-unavailable503approve, generate
invalid-cancel422cancellation (FINAL: replays from the store)
transfer-not-found404cancellation, GET /v1/transfers/{id} (R on cancellation: the transfer arrives by another request)
cancel-refused409cancellation (FINAL: PICKED onwards never returns)
cancel-unavailable503cancellation
approval-unavailable503approve
rebalance-runs-unavailable503GET /v1/rebalance-runs
invalid-limit400every paged GET (limit outside 1–500)
invalid-cursor400every paged GET (cursor does not decode)
unknown-query-parameter400every paged GET (a parameter it does not declare, e.g. the retired offset, after, nextToken)
idempotency-key-required / idempotency-key-invalid400every POST (missing key; not 1-128 printable ASCII)
idempotency-key-reused409every POST (same key, different method/path/body)
idempotency-unavailable503every POST on an instance without its idempotency store (no database)
catalogue-unavailable503GET/PUT /v1/rebalance-policies, GET/PUT /v1/transfer-lanes (no database, or the store failed)
invalid-if-match400catalogue PUT (If-Match is not a revision)
invalid-catalogue-entry422catalogue PUT (missing key, negative value, TargetStock below SafetyStock, lane to itself)
version-mismatch412catalogue PUT (If-Match is not the current revision)
concurrent-modification409catalogue PUT (lost a write race on the same revision)
read-side-unavailable503GET /v1/transfers, GET /v1/transfers/{id}
invalid-query400GET /v1/transfers (unknown state)
transfer-not-found404GET /v1/transfers/{id}
invalid-report-range400nip-reports /reports/*
invalid-report-limit400/reports/stuck-transfers
report-store-error500nip-reports /reports/*

MCP tools report the same slugs as the prefix of an isError result (invalid-query: ..., transfer-not-found: ..., read-side-unavailable: ..., read-models-unavailable: ..., read-models-incomplete: ...), and internal-error for anything untyped.