Skip to main content

Troubleshooting

Each row below follows a failure mode that exists in the code, from the symptom you see to the cause, how to confirm it, and the fix. Log messages are quoted exactly as the binaries emit them (see Observability). Configuration names are in Configuration.

Boot and readiness​

SymptomCauseCheckFix
Pod in CrashLoopBackOff, never ReadyPostgres unreachable or migrations failing. Boot retry gives up after 5 attempts (1+2+4+8 = 15s of backoff) and the process exits 1. /readyz checks Postgres and a Kafka broker, so an unreachable dependency leaves a running pod Not Ready.Last log line: service exited with error (facility) / mcp server exited with error, with run migrations (after 5 attempts): … or ping database (after 5 attempts): …Fix the DSN, network policy or Secret. For migration errors see the next row.
pq: unnamed prepared statement does not exist or canceling statement due to statement timeout during run migrations, with replicas racingMigrations went through PgBouncer (transaction pooling), so the advisory lock is not a real mutex (ADR-0023)Is MIGRATIONS_DATABASE_URL set in the pod? The chart reads it with optional: true, so a Secret without the key silently falls back to DATABASE_URL.Add the direct DSN under the MIGRATIONS_DATABASE_URL key of the database Secret, then restart.
golang-migrate reports a dirty database versionA previous migration failed halfwaySELECT * FROM schema_migrations; shows dirty = trueRepair the partial change by hand, set dirty = false at the last good version, then restart. The pods re-run pending migrations.
facility-projector / facility-reports exit immediately with ANALYTICS_DATABASE_URL is requiredThe analytics Secret is missing or analytics.database.* is emptykubectl describe pod envSet analytics.database.projectorUrl / reportsUrl or existingSecret (keys ANALYTICS_DATABASE_URL, ANALYTICS_READER_DATABASE_URL).
Pod exits at boot with DATABASE_URL is required, KAFKA_BROKERS is required or ANALYTICS_CONSUMER_GROUP is requiredMandatory configuration is missing (ADR 0039: there is no in-memory fallback and no log-only publisher). The chart normally refuses to render this, so it points at an override outside the chartThe last log line names every missing variableSet database.url or database.existingSecret, kafka.brokers, and (analytics) analytics.projector.consumerGroup.
Startup probe kills the pod during bootBoot (retry plus migrations) took longer than 60s (2s × 30)Events: Startup probe failedUsually a symptom of the first row. Raise startupProbe.failureThreshold only if migrations are legitimately slow.
Telemetry missing, no errors visibleCollector unreachable: export errors are logged only at debugRun with LOG_LEVEL=debug and look for opentelemetry errorFix OTEL_EXPORTER_OTLP_ENDPOINT. Both host:4317 and http://host:4317 work.

Events not reaching Kafka​

SymptomCauseCheckFix
Pod Not Ready (/readyz 503) while /healthz is 200/readyz is the drain gate plus a Postgres ping plus a Kafka broker metadata check; one dependency is unreachable (the body names it). Traffic stops being routed to the pod; nothing already committed is lostcurl <pod>:8080/readyz shows which check failedFix broker or database connectivity; the pod returns to Ready by itself and the relay drains the backlog.
outbox_events rows with published_at IS NULL piling upThe relay cannot send: broker down, wrong KAFKA_BROKERS, or topic or ACL problemsSELECT id, event_type, attempts, last_error FROM outbox_events WHERE published_at IS NULL ORDER BY id LIMIT 20; and logs outbox relay pass failedFix broker connectivity. The relay retries every OUTBOX_RELAY_INTERVAL and resumes in order. No data is lost.
A consumer's span is not linked to the facility-layout request that caused the eventThe row was written with no active span (a background job, or a request outside otelchi) or before migration 0010. Such rows carry no trace context (ADR-0038)SELECT id, event_type, headers FROM outbox_events WHERE event_type = '<type>' ORDER BY id DESC LIMIT 5; shows headers NULLExpected for those rows. For new rows, check that the use case runs under the request's ctx, and that the consumer calls Extract before it starts its span.
One row with high attempts blocks everything behind itThe relay stops a pass at the first failure to keep per-aggregate order, until the row reaches OUTBOX_MAX_ATTEMPTS (default 20; with 0 it blocks forever)Same query: the lowest-id unpublished row has a growing attemptsFix the cause in last_error. Do not delete the row unless you accept losing that event. If the cap is 0, set OUTBOX_MAX_ATTEMPTS (ADR-0036).
ERROR outbox relay: row reached the attempt cap and is excluded from future claimsA row failed OUTBOX_MAX_ATTEMPTS sends (ADR-0036); later rows, including same-key ones, now overtake it and consumers never got itSELECT id, topic, event_type, key, attempts, last_error FROM outbox_events WHERE published_at IS NULL AND attempts >= 20; (use the configured cap)Fix the cause, then UPDATE outbox_events SET attempts = 0 WHERE id = <id>; (Runbook). The event is then delivered late, with its original CloudEvents id.
Consumers see duplicate eventsDelivery is at-least-once: a crash between send and mark republishes the eventSame CloudEvents id on two messagesExpected. Consumers must dedupe on id.
network-inventory-planning refuses every transfer for a site / never sees SiteCapabilityChangedThe site's capability was never set: a site starts capable of nothing at capabilityRevision 0 and nothing is published until the first PUT (ADR-0035)GET /sites/{siteCode}/transfer-capability shows capabilityRevision: 0; SELECT event_type, published_at FROM outbox_events WHERE event_type LIKE '%SiteCapabilityChanged' ORDER BY id DESC LIMIT 5;PUT /sites/{siteCode}/transfer-capability with both flags. Repeating the current snapshot publishes nothing, by design.
network-inventory-planning says a site's capability is stale although it was setThe heartbeat is not publishing: SITE_CAPABILITY_HEARTBEAT_INTERVAL=0, the site is decommissioned, or the outbox relay is backed up (ADR-0041)SELECT code, capability_revision, capability_heartbeat_at FROM sites WHERE capability_revision > 0; and logs site capability heartbeat failed / disabledSet the interval (default 5m, at most half of NIP's 10 minute window) and fix the relay (see the outbox rows above); a decommissioned site is not heartbeated by design.
A site shows siteRole: UNSPECIFIED after the upgradeMigration 0009 only classified names matching <CODE> - <Role words> (<city>) with one of the 15 role phrases (or the whole name Simulated FC); anything else stays UNSPECIFIED (ADR-0037)SELECT code, name FROM sites WHERE site_role = 'UNSPECIFIED';PUT /sites/{siteCode}/role with the right role. Renaming the site does not reclassify it: the name is display text only.
A role change did not enable/disable transfersBy design: a role never flips capability (ADR-0037); capability is only PUT /sites/{siteCode}/transfer-capability (ADR-0035)GET /sites/{siteCode}/transfer-capabilityApply the role's row of GET /site-roles/transfer-defaults with the capability PUT.
Tuning config.outboxRelayInterval / housekeeping values in Helm does nothingA chart older than gap fix D14 (2026-10-12) renders the ConfigMap but mounts it in no Deployment. Current charts mount it in the api Deployment with envFrom.kubectl get deploy <fullname> -o yaml shows no envFrom/configMapRef; kubectl exec … env does not show OUTBOX_RELAY_INTERVALUpgrade the chart. On an old chart, pass the variables through extraEnv. An extraEnv entry wins over the ConfigMap for the same key.

Analytics pipeline​

SymptomCauseCheckFix
Report stops moving, lagSeconds keeps growingThe projector's consume loop ended after a commit or DLQ write failure. The pod is still Live.Log analytics consumer stoppedFix Kafka connectivity, then kubectl rollout restart deploy/<fullname>-projector.
Messages on warehouse.facility.analytics.dlqProjection failed 3 times (analytics: exhausted retries…), or the message was not a CloudEvent (analytics: message is not a valid CloudEvent…)Read the DLQ message headers x-dlq-error, x-dlq-source-topic, x-dlq-failed-atFix the cause (analytical DB, schema), then re-produce the body onto the source topic (Runbook).
A brand-new projector replays the whole historyBy design: a new group starts at the earliest offsetGroup facility-analytics offsetsExpected. Idempotency on the event id makes it safe.
GET /reports/catalog-growth → 400 invalid-report-queryfrom/to missing or not RFC3339, or granularity is not dayProblem detailSend from=2026-10-01T00:00:00Z&to=2026-10-02T00:00:00Z.
GET /reports/... → 500 report-store-errorAnalytical DB unreachable or schema missing (the projector never ran migrations)Problem detailStart the projector first, since it owns the analytical schema.
MCP has no catalog-growth toolREPORTS_BASE_URL is unset (the chart only sets it when analytics.enabled or mcp.reportsBaseUrl is set)Log catalog-growth report tool wired is absentEnable analytics or set mcp.reportsBaseUrl.

REST problem responses​

All errors are RFC 7807 application/problem+json. The type ends in the slug below (internal/adapters/inbound/http/errors.go, idempotency.go). There is no If-Match/ETag handling, so the API never returns 412. Optimistic concurrency surfaces as a 409.

StatusSlug(s)Meaning / fix
400idempotency-key-requiredA resource-creation POST (sites, zones, aisles, location types, placement rules, locations, fixed structures, cross-aisles) was sent without Idempotency-Key while Postgres is configured. Send a fresh UUID per logical request. Bulk import and decommission are exempt (ADR-0019). Browser clients: the CORS allow-list includes the header.
409idempotency-key-reusedSame key, different method, path or body (fingerprint = method + path + SHA-256 of the body). Use a new key. Same key with the same request replays the cached status, headers and body, but only for an answer that was final for the request (a 2xx or a FINAL refusal, ADR-0046): a RETRYABLE refusal (concurrent-modification, the *-not-found parents, placement-rule-violated, ...) and a 5xx are not stored, so the same key retried executes again, and after such a refusal a different body under the key is a new request, not this 409. Keys live for IDEMPOTENCY_KEY_TTL (24h), after which a reused key is treated as new.
400malformed-request-body, malformed-location-code, invalid-site-code, invalid-zone-code, invalid-aisle-code, invalid-location-type, invalid-layout-formatSyntax or shape errors. Read detail. Location codes follow SITE-AREA-ZONE-AISLE-BAY-LEVEL-POSITION (see Location code).
404site-not-found, zone-not-found, aisle-not-found, location-slot-not-found, location-type-not-found, placement-rule-not-foundRegister the parent first. Order: site → zone → aisle → location type → placement rule → slot.
409duplicate-* (site code, zone, aisle, location type, placement rule, location code, fixed structure, cross-aisle)Natural key already exists. Codes are permanent: there is no rename.
409site-not-active, zone-not-active, aisle-not-active, already-decommissionedDecommission is one-way (ADR-0005). Register a new code instead.
409concurrent-modificationAnother writer changed the slot or site between load and save (version column, ADR-0025; sites since ADR-0035). Re-fetch and retry; for a POST the key is released (ADR-0046), so the retry may reuse the same Idempotency-Key. On PUT /sites/{siteCode}/transfer-capability it means two operators changed the same site at once: re-read GET …/transfer-capability and PUT again.
400missing-transfer-capability-fieldPUT /sites/{siteCode}/transfer-capability without both transferOriginEnabled and transferDestinationEnabled as booleans. The body is a full snapshot; send both (ADR-0035).
422invalid-site-rolePOST /sites with a siteRole that is not one of the known roles, or PUT /sites/{siteCode}/role with a missing, unknown or UNSPECIFIED role. Values are exact UPPER_SNAKE (NON_SORTABLE_FC, not Non-Sortable Fulfillment Center); the list is GET /site-roles/transfer-defaults (ADR-0037).
422placement-rule-violatedThe location type is not legal in this zone (ADR-0003). Check the placement rules for the zone. This is also counted as outcome=rejected_by_placement_rule.
422invalid-max-weight, invalid-max-volume, invalid-dimensions, invalid-z, invalid-pitch, unknown-*, dock-flow-required, work-center-activities-required, functional-attributes-not-allowed, zone-mismatch, cross-aisle-*, segment-*, empty-*, negative-*Semantically invalid values. detail names the field.
500internal-errorUnmapped error, usually a database error. Look for the http request error log with the same request_id.

MCP​

SymptomCauseFix
A tool call fails with session not found-style errors after a scale-outMCP sessions live in process memory (Mcp-Session-Id). A second replica does not know sessions created on the first.Keep mcp.replicaCount: 1 (ADR-0022).
Tool error text starts with a slug, e.g. site-not-found: …Expected: tool errors are slug-prefixed (ADR-0033)Map the slug as in the REST table above.

Not applicable to this service​

  • Circuit breaker open: facility-layout has no circuit breaker. It makes no synchronous outbound calls except mcp → facility-reports, which fails per call.
  • OLTP consumer lag: facility consumes no Kafka topic. The only consumer group is the projector's facility-analytics.