Skip to main content

Troubleshooting

Synced from warehouse-ops-agent

This page is a copy of docs/docs/operations/troubleshooting.md on develop, derived from that repository's code. Edit it there, then re-sync.

Every row below comes from a code path on this branch. The agent has no database, no Kafka consumer and no /readyz, so the fleet's usual "consumer lag", "DLQ growth" and "migration failed" rows do not apply (Runbook). Errors are a flat {"error": "<message>"} body, not RFC 7807 problem documents, so there are no 409, 412 or 422 problem types and no idempotency keys to conflict (the API is read-only GET).

Start every investigation with the startup line:

kubectl -n warehouse-systems logs deploy/warehouse-ops-agent | grep 'warehouse-ops-agent listening'

It lists each *_endpoint_configured flag and path_targets, which answers most "why is this feature off" questions.

Startup​

SymptomCauseCheckFix
Pod in CrashLoopBackOff; log warehouse-ops-agent exited with error with config: DAILY_BRIEF_PATH_TARGETS is not a valid JSON array of path targetsthe variable is set to something that is not a JSON array of objectskubectl get cm warehouse-ops-agent -o yaml and look at DAILY_BRIEF_PATH_TARGETSfix the JSON, or clear config.dailyBriefPathTargets to use the built-in default target
Same, with DAILY_BRIEF_PATH_TARGETS is set but lists no path targetsthe value is [] or null (ADR 0017)as abovelist at least one target, or unset the variable
Same, with policy: unrecognized LLM_MODE "<x>" (want off|shadow|on)typo in LLM_MODELLM_MODE in the ConfigMapset off, shadow or on
Same, with LLM_MODE=shadow requires ANTHROPIC_API_KEY (or on)non-off mode without a key; in the kind cluster var.anthropic_api_key was empty (Terraform warns about this in its check block)kubectl get secret warehouse-ops-agent-anthropic -o jsonpath='{.data.ANTHROPIC_API_KEY}' is emptysupply the key and restart, or set llm.mode to off
Same, with LLM_TOOL_ALLOWLIST entry "<x>" is not <upstream>/<tool>an allow-list entry has no / or an empty halfLLM_TOOL_ALLOWLISTuse <upstream>/<tool>, e.g. wes-work-planning/get_backlog_telemetry
Log http server failed with address already in use, process keeps running but nothing answersAGENT_ADDR port taken; locally the e2e harness puts workforce-management's MCP server on :8095lsof -i :8095run with AGENT_ADDR=:8096 (Configuration)
Startup takes up to 15 s longer in shadow/on, then llm reasoner: tool discovery failed for an upstreaman allow-listed upstream did not answer tools/list in timethe tools field of llm reasoner configured lists what was foundnot fatal: the model is offered only the tools that answered. Fix the upstream endpoint and restart to restore the full set

Readiness and health​

SymptomCauseCheckFix
Pod is Ready but every answer is degraded/healthz checks no upstream; it is green whenever the listener is upcall /daily-brief and look at each path's unavailable listfix the upstream or endpoint named there; the probe is working as designed
Pod never becomes Readythe process exited during startup (see above) before the listener openedkubectl logs --previousas in the Startup table

Answers from the REST routes​

SymptomCauseCheckFix
503 {"error":"product-master not configured"} from /master-data-gapsPRODUCT_MASTER_MCP_ENDPOINT unset; find_master_data_gaps is also missing from tools/liststartup line product_master_endpoint_configured: falseset upstreams.productMaster.endpoint
503 {"error":"inbound-receiving not configured"} from /inbound-outlookINBOUND_RECEIVING_MCP_ENDPOINT unsetinbound_receiving_endpoint_configured: falseset upstreams.inboundReceiving.endpoint
503 on /transfer-watch/* (transfer watch not configured (network-inventory-planning endpoint unset))NETWORK_INVENTORY_PLANNING_MCP_ENDPOINT unsetnetwork_inventory_planning_endpoint_configured: falseset upstreams.networkInventoryPlanning.endpoint
503 {"error":"explain travel factor not configured"} from /explain-travel-factorFACILITY_LAYOUT_MCP_ENDPOINT unset: no client is built (ADR 0023) and explain_travel_factor is missing from tools/listfacility_layout_endpoint_configured: falseset upstreams.facilityLayout.endpoint
502 from /explain-travel-factorfacility-layout unreachable, or it rejected the call with a non-validation slug or a slug-less message (internal/adapters/outbound/mcpclient/tool_error.go)log explain_travel_factor: facility-layout unavailable with errorcheck FACILITY_LAYOUT_MCP_ENDPOINT and facility-layout's MCP pod
400 from /explain-travel-factora location code is missing, or facility-layout answered malformed-*, invalid-*, *-required, validation-failed or missing-location-codethe error textsend both seven-segment codes, e.g. WH1-STOR-AMB-A07-01-01-A
400 from /flow-balance/{pathId}, message starting flow_balance_advisory:wes-work-planning returned a rebalance action outside NoActionNeeded, ThrottleUpstream, ReassignLabor (untrusted input is rejected, never defaulted)the error text names the valuea contract change in wes-work-planning; update internal/domain/policy to the new enum in a code change
/flow-balance/{pathId} always hold with partial: truea required signal is missing; missingSignals names it, e.g. workforce-management.get_staffing_gaplogs flow_balance_advisory: <upstream> unavailable and partial decisionfix that upstream; also check that buildingId and shiftId were sent, since empty values make the staffing lookup fail
No utilization in the flow balanceLABOR_PERFORMANCE_MCP_ENDPOINT unset or failing, the wes signal is missing, or pathId has no processPath binding in DAILY_BRIEF_PATH_TARGETSlog flow_balance_advisory: labor-performance unavailableset the endpoint; add a target binding pathId to its processPath
502 from /master-data-gapsproduct-master unreachable or a page failed; the report has no partial modethe error textretry once product-master is healthy
400 from /master-data-gapsunknown kind, or product-master rejected the cursorthe error textuse unclassified or dimension-discrepancy; restart the scan without cursor
502 from /inbound-outlookevery attempted section failedeach section's omitted reason in a partial 200 usually shows which tool fails firstcheck inbound-receiving's MCP server
staleReceipts always omitted with INBOUND_STALE_RECEIPT_AGE is not configuredthere is deliberately no defaultINBOUND_STALE_RECEIPT_AGEset config.inboundStaleReceiptAge, e.g. 6h
400 from /transfer-watch/stuckolderThanMinutes missing or not positive, limit outside 0–200, or state unknown or terminalthe error textsend olderThanMinutes=30 and a non-terminal state
404 from /transfer-watch/transfers/{id}network-inventory-planning answered a *-not-found slugthe iduse an existing transfer id
502 from /transfer-watch/imbalance right after a NIP restartnetwork-inventory-planning fails simulate_transfer_options until its read models are freshlog transfer_watch: network-inventory-planning call failedwait for NIP's projections to catch up
404 {"error":"order not found"} from /console/orders/{id}/lifecycleorder-management answered 404the order idexpected for an unknown order
One lifecycle stage is null in a 200that context's REST call failed or its URL is wrong; each URL falls back to a localhost default when unsetlog order_lifecycle: <context> unavailableset restUrls.* in the chart
fulfillment stage empty although tasks existtasks are looked up by each work unit's id (GET /tasks?orderRef=<workUnitId>), so no work units means no task lookupplanning.workUnits in the same responseexpected before the order is released (ADR 0002)
A dashboard section available: false, error: "<context> reports not available"the *-reports reader failed or the URL points nowhere; 5 s timeoutlog console_reports: section unavailableset reportsUrls.*; confirm the context's *-reports Deployment exists (analytics enabled)
freshnessLagSeconds: null but the section is availableonly the /freshness call failedlog console_reports: freshness unavailablenot a degradation; check the reader's /freshness route
400 from /console/reports/wms or /wesfrom/to not RFC3339, or to not after fromthe error textsend e.g. from=2026-10-09T00:00:00Z
Browser call from the console fails with a CORS errorthe console's origin is not in CORS_ALLOWED_ORIGINS (default only http://localhost:5173); only GET and OPTIONS are allowedbrowser devtools, Access-Control-Allow-Origin missingadd the origin to the chart value config.corsAllowedOrigins (comma-separated)
405 on a POST to a REST routeevery REST route is GET only—use GET; /mcp is the only path that accepts other methods

Daily brief​

SymptomCauseCheckFix
A path lists "wes-work-planning: ..." (or another upstream) in unavailablethat MCP call failed; an unset endpoint builds no client and reads "<upstream>: client not configured" (ADR 0023)the startup line's *_endpoint_configuredset the endpoint in upstreams.*
siteName is emptyfacility-layout list_sites failed; the brief continues without namesfacility_layout_endpoint_configuredset FACILITY_LAYOUT_MCP_ENDPOINT
No exception although one signal is clearly badan exception needs two of: backlog over its alarm threshold, path understaffed, stuck tasks above zero. Queue depth is not a signalthe path's backlog, staffing, stuckexpected behaviour (policy.deriveExceptions)
The brief monitors the wrong paththe built-in default target (WH1 / pick-zone-a) is in usepath_targets: 1 in the startup lineset config.dailyBriefPathTargets
capacityOutlook has omittedReasonwarehouse-planning unreachable, no capacity window covers the horizon, or the target has no planningPathIdthe reason textadd planningPathId to the target; check warehouse-planning
Brief is slow (tens of seconds)calls run in sequence, each up to 10 s, over a fresh MCP session per callserver span duration for /daily-brieffix the slow upstream; reduce path targets

Runtime signals​

SymptomCauseCheckFix
Every service normal, every metric 0, prometheus not in unavailableSourcesPROMETHEUS_URL unset: a stub reader returns no samplesConfigMap PROMETHEUS_URL is "" (the kind cluster does not set it)set prometheus.url
unavailableSources: ["loki"]LOKI_URL unset or the Loki query failedConfigMap LOKI_URLset runtimeSignals.lokiUrl
unavailableSources: ["prometheus"]at least one PromQL query failed (5 s timeout)Prometheus reachable at PROMETHEUS_URL + /api/v1/queryfix the URL or Prometheus
A context is missing from servicesit is not in RUNTIME_SIGNALS_SERVICES; the default lists eight contexts onlythe variableset runtimeSignals.services

LLM reasoner​

SymptomCauseCheckFix
source is always deterministic in shadowexpected: shadow mode never returns the model's planlog flow_balance_advisory: llm arbitration shows llm_action and agreenone; compare agreement before switching to on
source: fallback in on modethe reasoner errored, timed out (LLM_TIMEOUT, default 8 s), produced no plan in 6 turns, or the plan failed policy.ValidatePlanthe reason field of the arbitration log, e.g. policy: invalid plan: proposedHeads 60 outside [0,50]for timeouts raise LLM_TIMEOUT; for invalid plans no fix is needed, the deterministic answer is used
Every call falls back with anthropic: circuit breaker open for anthropic-llm5 consecutive failures, or more than half of at least 10 requests failed in a 30 s window; the breaker stays open 30 scircuit_breaker_state{dependency="anthropic-llm"} == 2fix the cause (key, network, Anthropic outage); the breaker half-opens after 30 s and closes on one success
Immediate fallback on every request, no retriesa 4xx from Anthropic (bad key, bad model id) is permanent and not retriedthe reason textfix ANTHROPIC_API_KEY or LLM_MODEL
llm.tool_call logs show refused: unknown tool, refused: schema validation failed or refused: enum re-check failedthe model asked for a tool it was not offered, or sent arguments outside the tool's schemathe outcome fieldnone; refusals are by design (ADR 0004)
An allow-listed tool is never offeredits upstream is not one of the five with a reasoner session (wes-work-planning, fulfillment-execution, workforce-management, inventory-storage, facility-layout), or discovery failed for ittools in llm reasoner configureduse one of the five upstreams; fix the endpoint

MCP server​

SymptomCauseCheckFix
A tool is missing from tools/listthe optional upstream behind it is not configuredMCP tools "Registered when" columnset the endpoint
Tool result isError: true with invalid severity "<x>"list_open_exceptions accepts only info, warning, critical—send a valid severity or omit it
Host expects a <slug>: prefix and cannot classify errorsthis server returns the use case's plain message, not an ADR 0018 slugMCP toolsmatch on the message text