Troubleshooting
Each row starts from what you see, names the code path that produces it, and gives the check and the fix. Log messages are quoted exactly as the code writes them. For variable defaults see Configuration; for metrics see Observability.
Boot and probes
| Symptom | Cause | Check | Fix |
|---|---|---|---|
Pod exits at once and logs service exited with error with invalid configuration: DATABASE_URL is required: this context runs on real Postgres (and/or KAFKA_BROKERS is required: this context runs on real Kafka) | cmd/workforce and cmd/mcp validate the mandatory environment before any connection and before the listener binds, and report every problem at once (ADR 0038). There is no in-memory mode and no log sink. | kubectl logs of the first container start | Set database.url or database.existingSecret and kafka.brokers in the chart (it refuses to render without them). |
Projector or reports exits with ANALYTICS_DATABASE_URL is required | Both analytics binaries need it | Analytics Secret keys ANALYTICS_DATABASE_URL / ANALYTICS_READER_DATABASE_URL | Set analytics.database.* or analytics.database.existingSecret. |
Projector exits with ANALYTICS_CONSUMER_GROUP is required: a stable Kafka group id for the projector; there is no default (or KAFKA_BROKERS is required: the projector consumes the analytics topic) | The projector's group is no longer a constant in the binary | env in the pod | analytics.projector.consumerGroup (chart default workforce-analytics, the group it has always used) and kafka.brokers. |
Exit with PATH_CATALOGUE_SOURCE=file is not supported: this context runs on real Kafka (or EVENT_PUBLISHER=log is not supported: this context publishes to real Kafka, or LABOR_PERFORMANCE_MODE=permissive is not supported: this context runs on real Kafka) | A retired mode is still set in extraEnv or the environment; PATH_CATALOGUE_FILE and the YAML loader no longer exist | env in the pod | Remove the variable (unset means kafka / kafka-cache), or set the supported value. The chart refuses these in extraEnv at render time. |
Exit with unknown EVENT_PUBLISHER "…", unknown PATH_CATALOGUE_SOURCE "…" or unknown LABOR_PERFORMANCE_MODE "…" | Typo in the variable | env | EVENT_PUBLISHER and PATH_CATALOGUE_SOURCE: unset or kafka. LABOR_PERFORMANCE_MODE: kafka-cache (or the http rollback). |
Exit with LABOR_PERFORMANCE_MODE=http requires LABOR_PERFORMANCE_BASE_URL | The REST rollback needs its base URL | env | Set LABOR_PERFORMANCE_BASE_URL. |
Exit with process-path catalogue did not become ready within 1m0s / labor-performance measured rate cache did not become ready within 1m0s | The 60 s WaitReady replay of the compacted topic did not reach the high-water mark | Topic exists and the broker is reachable from the pod. Look for retrying lines from connect … kafka consumer. | Fix broker reachability or topic retention. A very large topic may need more than 60 s; that timeout is a code constant. |
retrying … connect process-path catalogue kafka consumer with Unknown Topic Or Partition at boot | The input topic does not exist yet; the first metadata request makes the broker auto-create it, and the next attempt finds it | Boot log: succeeded after retry one attempt later | Nothing to do on a cold broker. If it keeps failing, the broker is unreachable (see the next row). |
Exit with invalid float env var | MAX_HOURS_PER_SHIFT or IDLE_SHARE_TRIM_THRESHOLD is not a number | env | Fix the value. These two crash; duration variables only warn and fall back. |
Logs show retrying … run migrations / open postgres pool, then … (after 5 attempts): … and exit | Postgres unreachable for longer than the boot-retry budget: 5 attempts, 1+2+4+8 = 15 s of waits (ADR 0032, whose "~31s" figure is historical; the code comment states the real budget). | Last error in the log (DNS, auth, connection refused) | Fix the DSN or the network. One retry around ~10 s is normal under Istio (first-dial reset) and is not a fault. |
CrashLoopBackOff with exit code 143 during boot | The kubelet killed a pod that was still booting: the startup probe (30 × 2 s = 60 s) ran out | kubectl describe pod → Startup probe failed. Look at the boot log timeline. | Find the slow step (migrations, Kafka replay). For a legitimately slow boot, raise startupProbe.failureThreshold. |
Migrations crash-loop on several replicas with pq: unnamed prepared statement does not exist or canceling statement due to statement timeout | golang-migrate's pg_advisory_lock running through PgBouncer transaction pooling (ADR 0025) | Does the Secret have MIGRATIONS_DATABASE_URL? It is optional: true, so a missing key silently falls back to DATABASE_URL. | Provision a direct, non-pooled MIGRATIONS_DATABASE_URL. |
Migration fails with Dirty database version N | A previous migration failed halfway | SELECT * FROM schema_migrations; | Repair by hand: apply or revert the partial change, then migrate force <N-1> against the direct DSN. |
/readyz returns 503 | Either the pod is draining after SIGTERM ({"status":"not_ready"}), or a dependency failed: Postgres did not answer a ping or no Kafka broker answered a metadata request (a dependency-unavailable problem naming postgres and/or kafka). The verdict is cached 3 s and each check is bounded to 2 s; topics are never required. /healthz stays 200 either way, so nothing restarts (ADR 0038). | readiness flipped to not-ready (draining) or readiness: dependency is not ready with dependency=postgres|kafka and the error, in the log | Draining: expected during rollout. Dependency: restore Postgres or the broker (KAFKA_BROKERS reachable from the pod). Writes accepted meanwhile stay in outbox_events and are relayed afterwards. |
/readyz never answers, but the process is running | The listener has not started: the boot is still in the catalogue or cache replay, or in migrations | The last boot log line | See the rows above. |
Requests
| Symptom | Cause | Check | Fix |
|---|---|---|---|
Every POST /shift-plans returns 503 installed-capacity-unavailable | INSTALLED_CAPACITY_MODE is permissive (the binary default; the Helm chart defaults to http since gap fix D24). It fails loud on purpose (ADR 0014). | WARN at boot: fulfillment-execution installed capacity client configured with mode=permissive | Chart: config.installedCapacityMode=http (the default) and, when fulfillment-execution is not fulfillment-execution in the same namespace, config.fulfillmentExecutionBaseUrl. Elsewhere: INSTALLED_CAPACITY_MODE=http, FULFILLMENT_EXECUTION_BASE_URL=…. |
| Shift-plan commits return 503 after working before | fulfillment-execution is down, or the breaker is open | circuit_breaker_state{dependency="fulfillment-execution"} == 2 | Restore fulfillment-execution. The breaker half-opens on its own. There is deliberately no retry on this call. The 503 is never stored under the Idempotency-Key: once the dependency is back, a retry with the same key runs again instead of replaying the 503. |
409 exceeds-installed-capacity / planned-heads-exceed-installed / planned-hours-exceed-capacity | A domain invariant of CommitShiftPlan | detail in the problem body | Lower the planned heads or hours, or register stations in fulfillment-execution. |
400 shift-plan-missing-installed-stations | A POST /shift-plans line omitted installedStations (or sent null); the field is required. An explicit 0 is a stated count and is answered 409 planned-heads-exceed-installed instead | The request body | Send the installed station count for every line. |
400 unknown-path-id | The path id is not in the Kafka-replayed catalogue | Boot log process-path catalogue is ready lists the ids; on a fresh local broker the topic is empty | Use a catalogue id, publish the ProcessPathCreated event (the Quickstart shows one), or wait for the catalogue consumer to receive it (no restart needed). |
409 certification-required, associate-on-break, associate-shift-ended, max-hours-exceeded | AssignLabor invariants | Also visible as workforce_labor_assignments_total{outcome="rejected", reason=…} | Business outcome, not a fault. Certify the associate, end the break, and so on. |
409 associate-already-on-break / associate-not-on-break | Break state machine | Current associate state | Call break-ends or break-starts as appropriate. |
409 concurrent-modification | Optimistic-concurrency version check lost a race (ADR 0021) | Several writers on the same associate or plan | Reload and retry. |
400 idempotency-key-required | a POST sent without Idempotency-Key while Postgres is wired (ADR 0027, ADR 0040); a key that is not 1-128 printable ASCII starting and ending with a visible character is 400 idempotency-key-invalid (ADR 0042) | Request headers | Send a unique Idempotency-Key per logical request. |
409 idempotency-key-reused | Same key, different method, path or body | Client key generation | Use a new key for a different request. A same-key, same-body retry replays the stored response when the first answer was FINAL (a 2xx or a FINAL refusal, ADR 0044); a RETRYABLE refusal and a 5xx are never stored — the key is released and the retry runs again (see below). |
| A retry after a day does something new instead of replaying | The key's row was swept after IDEMPOTENCY_KEY_TTL (24 h) | config.idempotencyKeyTtl | Expected: the TTL is the replay window. |
400 missing-building-id on staffing-gap, 422 conflicting-site-and-building on shift-plan commit / plan proposal | neither siteCode nor the deprecated buildingId was sent; or, on commit and proposal only, both were sent with different values. A staffing-gap read does not reject a differing pair: buildingId is the plan key and siteCode the scope (ADR 0035, "Decided (2026-10-08)") | Query string / body | Send siteCode only. The slug keeps its legacy name on purpose. |
| Browser call blocked by CORS | Origin not in CORS_ALLOWED_ORIGINS (default http://localhost:5173,http://localhost:5185) | Browser devtools preflight | Add the origin. Behind Kong on the same origin, CORS does not apply. |
ProposePathPlan never uses a measured rate | The measured-rate cache has not received the path's TaskPerformanceRecorded yet, or LABOR_PERFORMANCE_MODE=http and the breaker is open | Boot log labor-performance measured rate client configured with its mode (kafka-cache or http); circuit_breaker_state{dependency="labor-performance"} | Wait for labor-performance to publish the path's measurement, or in http mode restore the dependency and check LABOR_PERFORMANCE_BASE_URL. |
| Staffing gap or proposal ignores idleness | The idle-share signal only exists in kafka-cache mode (the default; http is the rollback) | Same boot log | LABOR_PERFORMANCE_MODE=kafka-cache (ADR 0020). |
Events and analytics
| Symptom | Cause | Check | Fix |
|---|---|---|---|
No events on warehouse.workforce.events | The outbox relay is failing or the broker is unreachable (the relay is always on; there is no log-only publisher) | outbox relay pass failed logs; unpublished rows in outbox_events; /readyz naming kafka. The very first publish on a cold broker logs one ... Unknown Topic Or Partition ERROR while the broker auto-creates the topic, then recovers. | Fix broker reachability (kafka.brokers). Rows are relayed when it returns. |
workforce_outbox_lag_seconds keeps growing | The relay is failing on the head row and retries it every OUTBOX_RELAY_INTERVAL (ordering), or a row reached OUTBOX_MAX_ATTEMPTS (default 20) and is parked: later rows publish, but the parked row keeps the gauge growing (ADR 0036). | outbox relay pass failed logs; outbox relay: row reached the attempt cap and is no longer claimed (ERROR, with outbox_id, topic, event_type, key). SELECT id, event_type, key, attempts, last_error FROM outbox_events WHERE published_at IS NULL ORDER BY id LIMIT 5; | Fix the broker or topic. Below the cap the relay resumes on its own. A parked row needs UPDATE outbox_events SET attempts = 0 WHERE id = <id>;. Do not delete it unless you accept losing that event. |
Events written by cmd/mcp never reach Kafka | cmd/mcp only inserts into outbox_events; only cmd/workforce relays | Is cmd/workforce running against the same database? | Run the API against the same DATABASE_URL. |
outbox_events table keeps growing | Sweeper disabled (HOUSEKEEPING_INTERVAL=0), or the rows are unpublished (never swept) | housekeeping sweep logs; count of unpublished rows | Re-enable the sweeper, or fix the relay first. |
warehouse.workforce.analytics.dlq is growing | The projector cannot decode a message (not a CloudEvent), or keeps failing to apply it after 3 attempts | analytics: exhausted retries, sending to dead-letter topic with error. DLQ headers carry the source topic and the error. | Fix the producer or the projection, then re-produce the payload onto the source topic (Runbook). |
Labor report stale; GET /reports/labor/freshness lag rising; projector pod restarting | Projector consumer stopped. A commit or DLQ write error ends Run; since gap fix D13 the projector then exits non-zero (it no longer keeps /healthz at 200 over a dead consumer), so the pod restarts and may crash-loop while the cause persists. | analytics consumer stopped; exiting so the pod restarts in the projector log (kubectl logs --previous); pod restart count; lag of group workforce-analytics | Fix the broker error. The restarted projector resumes from the committed offset. |
GET /reports/labor/freshness returns 0 but the report is empty | lagSeconds is 0 both when caught up and when analytics_processed_events is empty | SELECT count(*) FROM analytics_processed_events; | Check that the API relay publishes (outbox_events drains) and that the projector consumes. |
GET /reports/labor returns 400 invalid-report-query | from/to missing or not RFC 3339, or granularity is not hour | Query string | ?from=2026-01-01T00:00:00Z&to=2026-01-02T00:00:00Z. |
MCP has no get_workforce_labor_report tool | REPORTS_BASE_URL unset | reports data-product tool enabled absent from the MCP boot log | Set mcp.reportsBaseUrl, or enable analytics so the chart defaults it. |
| MCP client gets session errors with 2+ MCP replicas | Only on a build before ADR 0041: per-process Mcp-Session-Id state and no session affinity. Current builds are stateless. | the image tag, mcp.replicaCount | Upgrade; on an older build keep 1 replica (see Runbook). |
Local development
| Symptom | Cause | Fix |
|---|---|---|
Logs fill with OTLP connection refused | No collector at localhost:4317 | Harmless. Run a collector, or point OTEL_EXPORTER_OTLP_ENDPOINT elsewhere. |
cmd/workforce or cmd/mcp exits with DATABASE_URL is required / KAFKA_BROKERS is required | There is no in-memory or log-only mode | docker compose up -d --wait, then export DATABASE_URL and KAFKA_BROKERS as in the Quickstart. |
| State created through MCP is not visible over REST | The two binaries point at different databases | Give both binaries the same DATABASE_URL. |