Skip to main content

Troubleshooting

Backend

SymptomCauseFix
RuntimeLockedError: another process holds the runtime lockSecond backend still flocking runtime/runtime.locklsof runtime/runtime.lock / `ps aux
IncompatibleRuntimeStateErrorstate.json version/epoch/tokens mismatch after code changeDelete runtime/state.json or run reset_runtime.py to reseed.
CorruptRuntimeStateErrorPartial write or missing attachmentDelete runtime/ and restart — _verify_attachments will re-seed.
409 store.epoch_mismatchClient sent stale expectedStateEpochFetch fresh GET /bookings/{id}/hub → retry with new epoch + new Idempotency-Key.
409 charge.version_conflictexpectedVersion ≠ current versionSame as above — refetch.
409 idempotency.payload_mismatchSame key reused with different body/digestGenerate new uuidgen for new intent.
413 attachment.*Per-file/total ceiling exceededShrink client-side: single ≤10 MiB, sum ≤25 MiB.
422 validation_failed with {field, rule}Strict model rejects unknown enum/float money/empty idRead details.errors[].field to locate; fix payload shape.
CORS 401 on /_dev/*X-Dev-Token missing / constant-time mismatchCheck KX_DEV_TOKEN and header spelling.
KX_WORKERS != 1 startup raisesJSON store is single-processRun with 1 or drop the env.
Wall-clock deadline flakeKX_DEMO_NOW not set, server clock vs local driftLaunch backend with KX_DEMO_NOW=2026-08-01T12:00:00Z for deterministic deadlines.

Useful one-liners

uv run python scripts/export_openapi.py --check docs/openapi-v1.json --verbose 2>&1 | diff -u docs/openapi-v1.json -
uv run python scripts/verify_fixture_manifest.py --bundle assets/fixtures
lsof runtime/runtime.lock; echo -- ; cat runtime/.kxinspect-runtime
curl -s http://127.0.0.1:8000/api/v1/health | python -m json.tool

Frontend

SymptomCauseFix
Red diagnostic screen on launchAppConfigException — bad --dart-defineRead listed issues (key+detail); fix API_BASE_URL when DATA_SOURCE=remote, fix URL normalization (must not end with slash etc.).
DatabaseException: no such tableDrift codegen stalerm lib/core/database/kx_database.g.dart && dart run build_runner build --delete-conflicting-outputs
Golden diff failsmacOS vs Linux rasterization or new tokenRegenerate on pinned image (flutter test --update-goldens) and inspect; never raise tolerance.
Navigator route not foundUnknown KxRoutes name or raw Navigator.pushUse goNamed(KxRoutes.chargeName, pathParameters:{...}); check test/architecture forbidden-API failure.
Photo strip overflows pageNested horizontal scrollOnly KxPhotoStrip may scroll horizontally — remove enclosing SingleChildScrollView axis horizontal.
Contest submit stays disabled at 10 graphemesASCII length vs grapheme miscountUse Characters(reason).length (emoji 🇬🇧 =1, zalgo =1) — see contest_policy.
Outbox never drains offline→onlineConnectivityCubit still offlineflutter run on Chrome requires navigator.onLine — check browser devtools network throttling.
SSE no updatesLast-Event-ID stale / ring trimmedExpect sync.required; SnapshotCoordinator will refetch; check dio logs for text/event-stream + 429 from chaos.
package:characters miscountUsing String.lengthReplace with Characters.
l10n key not foundMissing ARB entryAdd to both app_en.arb + app_cy.arb, run flutter gen-l10n.
flutter run -d chrome --dart-define=DATA_SOURCE=fixture &
sleep 5
# in Chrome address bar:
# http://localhost:8080/charges/CHG-001/contest
# http://localhost:8080/charges/CHG-001/photo/0
# Expect 200 and no redirect loop; -1 index should repair to parent with ?notice=photoIndexRepaired.

Docs site

cd documentation
npm ci
npm run typecheck
npm run build # throws onBrokenLinks == throw

If onBrokenLinks: throw trips, check relative link .md slug (../backend/... vs /docs/backend/...).

When to open an issue

Open against the right repo: seed/fixture/contract → backend repo; widget/l10n/routing → frontend repo. Include stateEpoch/storeRevision from last meta, DataSource + Ids, and reduced curl/ARB reproduction. Contract drift issues should include export_openapi --check diff and both commit SHAs.