Skip to main content

Troubleshooting

Every row below comes from a code path in this repository. Log messages are quoted exactly; see Observability for their fields.

Boot and readiness​

SymptomCauseCheckFix
Pod restarts with service exited with error and run migrations (after 5 attempts): ...Postgres unreachable, wrong credentials, or the first dial reset by a warming Istio sidecar for longer than the boot retry budget (5 attempts, ~15 s of backoff)Preceding retrying lines (op, err); kubectl get secret for DATABASE_URL / MIGRATIONS_DATABASE_URLFix the DSN or network. A pure sidecar race succeeds on the next restart.
Migrations fail with unnamed prepared statement does not exist or statement timeouts; replicas crash-loop togetherMIGRATIONS_DATABASE_URL unset, so golang-migrate runs through PgBouncer transaction pooling and its session advisory lock does not hold (ADR 0015)Is the MIGRATIONS_DATABASE_URL key present in the database secret? (the chart mounts it optional: true)Add a direct, non-pooled DSN under that key and restart.
Migration reports a dirty versionA previous run died mid-migration; golang-migrate refuses to continueSELECT * FROM schema_migrations; (dirty = true)Repair the half-applied change by hand, then set dirty = false at the right version. There is no make migrate helper.
pathmgmt-projector or pathmgmt-reports exits immediately with ANALYTICS_DATABASE_URL is requiredEnv var missingPod env; analytics secret keys ANALYTICS_DATABASE_URL / ANALYTICS_READER_DATABASE_URLSet analytics.database.* or existingSecret.
Projector migrations report a version that is not in migrations/analyticsThe analytical DSN points at the OLTP database; both schemas share golang-migrate's schema_migrations tableSELECT current_database(); on both DSNsUse a separate database for analytics.
/readyz returns 503 {"status":"not_ready"}The process received SIGTERM and is draining (SetNotReady)Pod is TerminatingExpected. A Postgres or Kafka outage is a different 503, dependency-unavailable (see "Pod Running but not Ready" below); it is a problem document, not this body.
In the kind cluster the api pod keeps receiving traffic during shutdownwarehouse-infra's helm-values/process-path-management.yaml overrides the readiness probe to /healthz, which never flipskubectl get deploy <release> -o yaml → readinessProbe.httpGet.pathPoint the override at /readyz (warehouse-infra change).
Startup probe fails before the app logs anythingImage or command: wrong; the MCP, projector and reports Deployments override the image ENTRYPOINT with /app/<binary>kubectl describe podFix the image tag or chart values.

Writes and the API​

Every error body is application/problem+json with type https://errors.process-path-management.warehouse-systems.dev/<slug>, title, status, detail (the Go error text) and instance (the request path). Mapping: internal/adapters/inbound/http/errors.go, idempotency.go, server.go, reports_handler.go.

Statustype slugWhenFix
400malformed-request-bodyBody is not valid JSON (or could not be read by the idempotency middleware)Send valid JSON.
400invalid-query-parameterGET /process-paths?all= is not exactly true or falseUse true/false.
400idempotency-key-requiredPOST /process-paths without Idempotency-Key, only when DATABASE_URL is setSend a unique key per logical create.
400idempotency-key-invalidIdempotency-Key is not 1-128 printable ASCII charactersSend a UUID.
400unknown-query-parameterGET /process-paths with a query parameter other than all, limit, cursor (for example the retired after or offset)Use limit and cursor.
400invalid-report-queryReports API: missing or non-RFC 3339 from/to, or granularity other than dayFix the query.
404path-not-foundGET/PUT/DELETE /process-paths/{pathId} for an unknown idCheck the id (case-sensitive).
404cpt-schedule-not-foundGET /sites/{siteId}/cpt-schedule before any PUTDefine the schedule first.
404route-not-foundAny path that matches no route (including an empty path segment)Check the URL; behind Kong the prefix is /api/process-path-management.
409path-already-existsPOST with a pathId that exists, active or deactivated; also a concurrent create that lost the insert racePick another id. A deactivated id can never be reused.
409path-referenced-by-cpt-scheduleDELETE of a path still listed in some site's eligiblePathIds; detail names the sites (ADR 0026)PUT those schedules without the path, then retry.
409idempotency-key-reusedSame Idempotency-Key with a different method, path or body (SHA-256 of the raw bytes, so whitespace counts; was 422 before ADR 0040)Use a new key for a different request.
409concurrent-modificationThe row's version changed between load and save (ADR 0017)Re-read and retry.
422path-deactivatedPUT /process-paths/{pathId} on a deactivated pathDeactivation is terminal; define a new path.
422empty-path-id, empty-match-prefix, match-prefix-not-lowercase, no-required-capabilities, invalid-cycle-time-p95, invalid-destination-location-role, invalid-intakePath invariants. invalid-cycle-time-p95 also covers a missing or unparseable cycleTimeP95 (it must be a positive Go duration such as 2h). destinationLocationRole must be Drop, WorkCenter, Shipping or omitted. intake must hold distinct values of CUSTOMER_ORDER, STOCK_TRANSFER, SLOT_RELOCATION, INVENTORY_CONTROL, REPLENISHMENT (ADR 0034, ADR 0036)Fix the body.
422ineligible-path-idA cutoff's eligiblePathIds names an unknown or deactivated pathDefine or pick an Active path.
422empty-timezone, invalid-timezone, no-cutoffs, empty-cpt-id, duplicate-cpt-id, empty-local-time, invalid-local-time, no-days-of-week, invalid-day-of-week, empty-ship-method, no-eligible-path-idsCPT schedule invariants (IANA zone, HH:MM 24-hour, days Mon…Sun, unique cptId per site)Fix the body.
500internal-errorAny unmapped error: database down, statement_timeout (5 s) hit, idempotency bookkeeping failureLogs around the request_id; Postgres health.
500report-store-errorReports API could not query the analytical database (15 s statement timeout, read-only pool)Check the analytical database.

There is no 412: the API has no If-Match/ETag precondition; concurrency is reported as 409 concurrent-modification.

Idempotency-key surprises​

SymptomCauseFix
A retried POST returns the same 422 or 409 as the first attempt even after fixing the dataThe refusal's problem type is FINAL (or OUTCOME), so its answer is cached under the key (ADR 0043): e.g. path-already-exists (a taken pathId is taken forever), the field-validation 422s, malformed-request-bodySend a new Idempotency-Key. A RETRYABLE refusal (nothing committed; the cause can change) is never stored — the same key can simply be retried.
An old key is accepted again as newThe sweeper deletes keys older than IDEMPOTENCY_KEY_TTL (24 h)Expected; keys are only remembered for the TTL.
POST works locally without the header but fails in the clusterThe middleware is only wired when DATABASE_URL is setAlways send the header.
A retry hangs until the first request finishesConcurrent requests with the same key serialise on the idempotency_keys primary keyExpected; the second request then replays the first's response.

Events not reaching consumers​

SymptomCauseCheckFix
Pod exits at boot (CrashLoopBackOff) with DATABASE_URL is required / KAFKA_BROKERS is requiredA mandatory variable is missing: there is no in-memory or log-only fallback (ADR 0037). EVENT_PUBLISHER other than kafka also stops the bootThe error names the variable; helm template refuses to render without database.url/database.existingSecret and kafka.brokersSet the value and redeploy.
Pod Running but not Ready; /readyz answers 503 dependency-unavailablePostgres or every Kafka broker is unreachable (verdict cached 3 s)The problem detail names the dependencyRestore the dependency; writes already accepted are in the outbox and are relayed afterwards.
process_path_management.outbox.lag_seconds keeps rising; outbox relay pass failed every secondBroker unreachable, or one row keeps failing and blocks the rows behind it until it reaches OUTBOX_MAX_ATTEMPTS (default 20)SELECT id, event_type, attempts, last_error FROM outbox_events WHERE published_at IS NULL ORDER BY id LIMIT 5;Fix the cause in last_error; see Runbook.
One event never arrives, later events of the same path do; outbox relay: row reached the attempt cap and is no longer claimed loggedThe row failed OUTBOX_MAX_ATTEMPTS times and is parked (ADR 0030); outbox.lag_seconds stays high while it is parkedThe ERROR line (outbox_id, topic, event_type, key) and the row's last_errorFix the cause, then UPDATE outbox_events SET attempts = 0 WHERE id = ... (Runbook).
Consumers see an event twiceAt-least-once relay: crash between broker ack and the UPDATE, or a manual re-publishSame CloudEvents id on both copiesExpected; consumers key by PathId/SiteId and the id.
A consumer sees events for one path out of orderShould not happen: rows drain in id order and the key (PathId) pins a partition via the Hash balancer (ADR 0013). The one deliberate exception is a row parked at the attempt cap and later re-armed: it arrives after newer events of its path (ADR 0030)Did someone change the writer's balancer? Was a row re-armed?Keep kafkago.Hash; after a re-arm, revise the path to re-publish its current state.
PUT returned 200 but no event was publishedThe revision changed nothing (same values), or DELETE hit an already-deactivated path; both are no-ops by designCompare the body with the current resourceExpected.

Analytics​

SymptomCauseCheckFix
Projector pod restarting, eventually CrashLoopBackOffThe consumer loop exited (an offset commit or a DLQ write failed, the broker is gone). Since gap fix D13 the projector then flips /readyz to 503 and exits 1 with analytics consumer loop exited instead of staying Ready while projecting nothingProjector logs (previous container: kubectl logs --previous), broker healthFix the broker or analytics database problem; the restarted pod resumes from its committed offsets.
warehouse.process-path-management.analytics.dlq growingNon-CloudEvents messages on the analytics topic, or the analytical database failing 3 attempts in a rowanalytics: sending message to dead-letter topic lines (ce_type, error); DLQ headers x-dlq-errorFix the database or the producer; then replay (see Runbook).
Report empty after enabling analyticsThe projector has not consumed yet, or the analytics database is a different one from the reports binary'sTopic offsets for warehouse.process-path-management.analytics and analytics_consumed_eventsCheck the projector's KAFKA_BROKERS/ANALYTICS_DATABASE_URL and its logs.
Replaying the topic does not change the reportBoth analytics_consumed_events and analytics_processed_events deduplicate on the CloudEvents id—Truncate the three analytics tables before resetting offsets (Runbook).
freshness says lagSeconds is hours or daysIt is "now minus the last projected event time", not consumer lag; it grows whenever nobody edits pathsCompare with the last ProcessPath* event timeUsually nothing to fix. Use broker-side group lag for real consumer lag.
get_catalogue_growth_report missing from MCP tools/listREPORTS_BASE_URL unset on the MCP pod (the chart sets it only when analytics.enabled or mcp.reportsBaseUrl)MCP pod envSet it and restart.
MCP tool returns reports client: unexpected status 400The tool forwards from/to/granularity as given; the reports API rejected themPass RFC 3339 timestamps and day—

MCP​

SymptomCauseFix
MCP sees no paths that the REST API returnsmcp points at a different Postgres than pathmgmt (DATABASE_URL is mandatory for both; there is no in-memory store)Point both binaries at the same Postgres.
tools/call fails with an unknown session after scaling MCP to 2+ replicasSessions live in process memory; the Service has no affinityKeep mcp.replicaCount: 1.
get_process_path returns a tool errorNot found is returned as an error result, by designCheck the id with list_process_paths (activeOnly: false).

Housekeeping​

SymptomCauseFix
outbox_events or idempotency_keys grows without boundDATABASE_URL unset on the replica (no sweeper), HOUSEKEEPING_INTERVAL=0 (sweeper disabled), a zero IDEMPOTENCY_KEY_TTL/OUTBOX_RETENTION (that half disabled), or housekeeping sweep failed on every tickCheck the housekeeping sweeper configured startup line (enabled, TTLs) and the logs; the sweeper deletes in 1000-row batches and resumes on the next tick.
IDEMPOTENCY_KEY_TTL=0s keeps keys foreverIntended since gap fix D15: a zero duration disables that half of the sweeper (ADR 0018)Set a positive Go duration (for example 24h) to delete them again.