Skip to content

[Bug]: GatewayRequestError: Error: file is not a database: code=ERR_SQLITE_ERROR #90491

Closed

Description

@AFabyTWE

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

I am running openclaw in a container in Azure Container Apps. I deployed a container with 2026.6.1. After doing some configuration and restarting the container I am seeing this error in the web UI:

GatewayRequestError: Error: file is not a database: code=ERR_SQLITE_ERROR

The openclaw logs show several other ERR_SQLITE_ERROR messages. (below)

I redeployed the container and it resolved the issue. After another restart I observed the error one more time.

I reverted my container image back to 2026.5.27 and the container is working just fine now.

Steps to reproduce

  1. Deploy container image version 2026.6.1.
  2. Restart the container.
  3. Gateway report SQLITE errors.

Expected behavior

Container should continue to work after restart.

Actual behavior

Gateway display SQLITE error. Openclaw CLI refuses to work with similar SQLITE error related to plugin state database.

OpenClaw version

2026.6.1

Operating system

Docker image Debian version

Install method

docker

Model

claude-sonnet-4-6

Provider / routing chain

openclaw -> prompt security gateway -> Anthropic

Additional provider/model setup details

No response

Logs, screenshots, and evidence

2026-06-05T00:29:05.26957  Connecting to the container 'openclaw'...
2026-06-05T00:29:05.29967  Successfully Connected to container: 'openclaw' [Revision: 'heimdall-app--0000004', Replica: 'heimdall-app--0000004-7769bd8576-jjkm2']
2026-06-05T00:24:36.7380730Z stdout F 2026-06-05T00:24:36.737+00:00 [ws] ⇄ res ✓ agent.identity.get 226ms conn=880de20a…f4dc id=262e2b05…203d
2026-06-05T00:24:36.7416932Z stdout F 2026-06-05T00:24:36.740+00:00 [ws] ⇄ res ✓ health 229ms cached=true conn=880de20a…f4dc id=9d433464…e9db
2026-06-05T00:24:37.1952035Z stderr F 2026-06-05T00:24:37.194+00:00 [gateway] request handler failed: Error: file is not a database: code=ERR_SQLITE_ERROR
2026-06-05T00:24:37.1966523Z stdout F 2026-06-05T00:24:37.196+00:00 [ws] ⇄ res ✗ chat.startup 418ms errorCode=UNAVAILABLE errorMessage=Error: file is not a database: code=ERR_SQLITE_ERROR conn=880de20a…f4dc id=b89547ec…8127
2026-06-05T00:24:37.3207625Z stdout F 2026-06-05T00:24:37.320+00:00 [ws] ⇄ res ✓ agents.list 83ms conn=880de20a…f4dc id=cde13576…a687
2026-06-05T00:24:37.5809793Z stdout F 2026-06-05T00:24:37.580+00:00 [ws] ⇄ res ✓ models.authStatus 343ms conn=880de20a…f4dc id=49884b73…2f90
2026-06-05T00:24:47.9522673Z stderr F 2026-06-05T00:24:47.952+00:00 [tasks/task-registry-maintenance] Failed to list ACP sessions during task maintenance
2026-06-05T00:25:47.9417863Z stderr F 2026-06-05T00:25:47.941+00:00 [tasks/task-registry-maintenance] Failed to list ACP sessions during task maintenance
2026-06-05T00:26:41.5404355Z stdout F 2026-06-05T00:26:41.540+00:00 [ws] webchat disconnected code=1001 reason=n/a conn=880de20a-af68-4baa-9eb6-b33547dff4dc
2026-06-05T00:26:41.6584043Z stderr F 2026-06-05T00:26:41.657+00:00 [ws] Proxy headers detected from untrusted address. Connection will not be treated as local. Configure gateway.trustedProxies to restore local client detection behind your proxy.
2026-06-05T00:26:42.1028128Z stdout F 2026-06-05T00:26:42.102+00:00 [ws] webchat connected conn=b601fd8c-773e-4451-89b7-2f1293736415 remote=100.100.1.42 client=openclaw-control-ui webchat vcontrol-ui
2026-06-05T00:26:42.5402657Z stdout F 2026-06-05T00:26:42.539+00:00 [ws] ⇄ res ✓ commands.list 346ms conn=b601fd8c…6415 id=f015042b…77a1
2026-06-05T00:26:43.2201476Z stderr F 2026-06-05T00:26:43.219+00:00 [gateway] request handler failed: Error: file is not a database: code=ERR_SQLITE_ERROR
2026-06-05T00:26:43.2223519Z stdout F 2026-06-05T00:26:43.222+00:00 [ws] ⇄ res ✗ chat.startup 1072ms errorCode=UNAVAILABLE errorMessage=Error: file is not a database: code=ERR_SQLITE_ERROR conn=b601fd8c…6415 id=ac0168b4…c99a
2026-06-05T00:26:43.2601904Z stdout F 2026-06-05T00:26:43.259+00:00 [ws] ⇄ res ✓ models.list 1067ms conn=b601fd8c…6415 id=abbe1113…e57d
2026-06-05T00:26:43.6274661Z stdout F 2026-06-05T00:26:43.627+00:00 [ws] ⇄ res ✓ models.authStatus 157ms conn=b601fd8c…6415 id=be360876…324b
2026-06-05T00:26:43.7298469Z stdout F 2026-06-05T00:26:43.729+00:00 [ws] ⇄ res ✓ agents.list 260ms conn=b601fd8c…6415 id=1fd25f78…fab5
2026-06-05T00:26:47.9466808Z stderr F 2026-06-05T00:26:47.946+00:00 [tasks/task-registry-maintenance] Failed to list ACP sessions during task maintenance
2026-06-05T00:27:47.9495164Z stderr F 2026-06-05T00:27:47.949+00:00 [tasks/task-registry-maintenance] Failed to list ACP sessions during task maintenance
2026-06-05T00:28:47.9534200Z stderr F 2026-06-05T00:28:47.953+00:00 [tasks/task-registry-maintenance] Failed to list ACP sessions during task maintenance

Impact and severity

High impact. Agent is unusable.

Additional information

No response

Activity

  1. clawsweeper commented on Jun 5, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 4, 2026, 8:45 PM ET / 00:45 UTC.

    Summary
    Keep open: this is a recent external regression report, and current main still routes the reported chat.startup, ACP maintenance, task, and plugin-state paths through shared SQLite state without an obvious unreadable-database recovery path. The 2026.6.1 release also explicitly moved several restart-sensitive state surfaces toward SQLite, matching the reporter's version window.

    Reproducibility: no. high-confidence current-main reproduction was established in this read-only review. The source path is clear from the provided logs: chat.startup, ACP task maintenance, and plugin state all still read the shared SQLite state database.

    Ways to help us reproduce this

    • Add a screenshot or short recording showing the behavior.
    • Add expected vs actual behavior.

    Next step
    A maintainer-quality Docker/current-main repro is needed before a safe repair lane because the report does not identify which SQLite file became non-database data.

    Review details

    Best possible solution:

    Reproduce the Docker restart failure against current main, identify which SQLite file becomes unreadable, then add a narrow state-database repair or diagnostic path with regression coverage for gateway startup and plugin-state access.

    Do we have a high-confidence way to reproduce the issue?

    No high-confidence current-main reproduction was established in this read-only review. The source path is clear from the provided logs: chat.startup, ACP task maintenance, and plugin state all still read the shared SQLite state database.

    Is this the best way to solve the issue?

    Unclear because no fix is proposed yet. The maintainable fix should stay in the shared SQLite/plugin-state lifecycle and prove both fresh container startup and restart/upgrade behavior.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • No live Docker/Azure current-main reproduction was run in this read-only review, so the exact corrupt database file and writer remain unknown.
    • Several current consumers share state/openclaw.sqlite, so the repair should identify whether the failure is shared state, per-agent state, or legacy plugin-state migration before changing recovery behavior.

    Codex review notes: model gpt-5.5, reasoning high; reviewed against ecb6779a1632.

    Label changes

    Label changes:

    • add P1: The reported regression leaves the supported Docker image's gateway and CLI unusable after restart.
    • add impact:data-loss: The central symptom is an unreadable persisted SQLite state database after restart.
    • add impact:crash-loop: The SQLite failure makes core gateway request handling unavailable after restart.
    • add impact:session-state: The failing paths include chat startup, ACP session metadata, task maintenance, and plugin state.
    • add issue-rating: 🐚 platinum hermit: Current issue advisory state selects this label.
    • add clawsweeper:needs-live-repro: Current issue advisory state selects this label.
    • add clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.
    • add clawsweeper:needs-maintainer-review: Current issue advisory state selects this label.

    Label justifications:

    • P1: The reported regression leaves the supported Docker image's gateway and CLI unusable after restart.
    • impact:crash-loop: The SQLite failure makes core gateway request handling unavailable after restart.
    • impact:data-loss: The central symptom is an unreadable persisted SQLite state database after restart.
    • impact:session-state: The failing paths include chat startup, ACP session metadata, task maintenance, and plugin state.
    Evidence reviewed

    Acceptance criteria:

    • Docker or Testbox repro using the 2026.6.1 image and current main image: configure, restart, and verify chat.startup plus CLI plugin-state access.
    • Focused regression coverage around src/state/openclaw-state-db.ts, src/plugin-state/plugin-state-store.sqlite.ts, and the gateway/task callers once the failing file owner is known.

    What I checked:

    • Shared state database is still the central runtime path: Current main resolves the shared state database to state/openclaw.sqlite, opens it with DatabaseSync, and runs schema setup before returning the cached handle. (src/state/openclaw-state-db.ts:695, ecb6779a1632)
    • Plugin state uses the shared state database: The plugin-state store opens openOpenClawStateDatabase() and wraps failures as Failed to open the plugin state database, matching the reporter's CLI/plugin-state symptom. (src/plugin-state/plugin-state-store.sqlite.ts:328, ecb6779a1632)
    • Reported Gateway and maintenance surfaces exist on main: chat.startup still calls the chat history handler, and task maintenance still logs Failed to list ACP sessions during task maintenance when ACP session listing fails. (src/gateway/server-methods/chat.ts:2520, ecb6779a1632)
    • No obvious current recovery branch for not-a-database state: A focused search of state, plugin-state, task, ACP, gateway, doctor/CLI-adjacent paths found no explicit handler for file is not a database, SQLITE_NOTADB, integrity_check, or quick_check. (ecb6779a1632)
    • Release window matches SQLite state movement: The v2026.6.1 changelog says plugin install ledgers, session metadata, gateway runtime state, plugin metadata, and store writes moved toward SQLite-backed or cached state. (CHANGELOG.md:58, 2e08f0f4221f)
    • Docker state is expected to survive restarts: Docker VM docs state long-lived OpenClaw state must survive restarts, rebuilds, and reboots, so an unreadable persisted SQLite database after restart is actionable in-repo. Public docs: docs/install/docker-vm-runtime.md. (docs/install/docker-vm-runtime.md:120, ecb6779a1632)

    Likely related people:

    • Peter Steinberger: Current checkout blame and recent history place the shared state DB, plugin-state wrapper, task store, and gateway startup lines on recent commits by this author. (role: recent area contributor; confidence: medium; commits: 499590754172, b2e320dfb138, edb920b857ce; files: src/state/openclaw-state-db.ts, src/plugin-state/plugin-state-store.sqlite.ts, src/tasks/task-registry.store.sqlite.ts)
    • Vincent Koc: The v2026.6.1 release commit is by this author and includes the release note for SQLite-backed state movement that matches the reported regression window. (role: release provenance; confidence: low; commits: 2e08f0f4221f; files: CHANGELOG.md)
    • RomneyDa: The v2026.6.1 changelog credits this login on the SQLite-backed state movement entry that overlaps the suspected regression area. (role: adjacent release-note contributor; confidence: low; commits: 2e08f0f4221f; files: CHANGELOG.md)
    • NianJiuZst: The v2026.6.1 changelog credits this login on the SQLite-backed state movement entry that overlaps the suspected regression area. (role: adjacent release-note contributor; confidence: low; commits: 2e08f0f4221f; files: CHANGELOG.md)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
    • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
  2. AFabyTWE commented on Jun 5, 2026

    @AFabyTWE
    Author

    Some additional logs:
    [openclaw] Could not start the CLI.
    [openclaw] Reason: Failed to open the plugin state database. | file is not a database
    [openclaw] Debug: set OPENCLAW_DEBUG=1 to include the stack trace.
    [openclaw] Try: openclaw doctor
    [openclaw] Help: openclaw --help

    026-06-05T00:11:06.5067599Z stdout F 2026-06-05T00:11:06.506+00:00 [gateway] loading configuration…
    2026-06-05T00:11:06.5803890Z stdout F 2026-06-05T00:11:06.580+00:00 [gateway] resolving authentication…
    2026-06-05T00:11:06.5921474Z stdout F 2026-06-05T00:11:06.591+00:00 [gateway] starting...
    2026-06-05T00:11:07.7801756Z stderr F 2026-06-05T00:11:07.779+00:00 [agents/subagent-registry] failed to restore subagent runs from disk: file is not a database
    2026-06-05T00:11:07.8837775Z stdout F 2026-06-05T00:11:07.883+00:00 [gateway] starting HTTP server...
    2026-06-05T00:11:07.8858027Z stderr F 2026-06-05T00:11:07.885+00:00 [gateway] ⚠️ Gateway is binding to a non-loopback address. Ensure authentication is configured before exposing to public networks.
    2026-06-05T00:11:07.9769123Z stderr F 2026-06-05T00:11:07.976+00:00 [tasks/registry] Failed to restore task registry
    2026-06-05T00:11:07.9907109Z stdout F 2026-06-05T00:11:07.990+00:00 [health-monitor] started (interval: 300s, startup-grace: 60s, channel-connect-grace: 120s)
    2026-06-05T00:11:10.3855876Z stdout F 2026-06-05T00:11:10.385+00:00 [gateway] agent model: prompt-security/claude-sonnet-4-6 (thinking=medium, fast=off)
    2026-06-05T00:11:10.3866897Z stdout F 2026-06-05T00:11:10.386+00:00 [gateway] http server listening (9 plugins: browser, canvas, device-pair, diagnostics-otel, file-transfer, lossless-claw, memory-core, phone-control, talk-voice; 3.8s)
    2026-06-05T00:11:10.3918274Z stdout F 2026-06-05T00:11:10.391+00:00 [gateway] log file: /tmp/openclaw/openclaw-2026-06-05.log
    2026-06-05T00:11:10.3943582Z stdout F 2026-06-05T00:11:10.394+00:00 [gateway] starting channels and sidecars...
    2026-06-05T00:11:10.6326412Z stdout F 2026-06-05T00:11:10.629+00:00 [plugins] diagnostics-otel: logs exporter enabled (OTLP/Protobuf)
    2026-06-05T00:11:10.6408494Z stdout F 2026-06-05T00:11:10.640+00:00 [gateway] ready
    2026-06-05T00:11:10.7347960Z stdout F 2026-06-05T00:11:10.734+00:00 [heartbeat] started
    2026-06-05T00:11:10.8278575Z stderr F 2026-06-05T00:11:10.827+00:00 [gateway] Delivery recovery failed: Error: file is not a database
    2026-06-05T00:11:11.2348377Z stderr F 2026-06-05T00:11:11.234+00:00 [plugins] memory-core: dreaming startup reconciliation failed: file is not a database
    2026-06-05T00:11:11.9162028Z stderr F 2026-06-05T00:11:11.915+00:00 [cron] failed to start: Error: file is not a database
    2026-06-05T00:11:12.0493023Z stderr F 2026-06-05T00:11:12.049+00:00 [gateway] Session delivery recovery failed: Error: file is not a database
    2026-06-05T00:11:13.0237105Z stderr F 2026-06-05T00:11:13.023+00:00 [tasks/task-registry-maintenance] Failed to list ACP sessions during task maintenance
    2026-06-05T00:11:14.4549970Z stdout F 2026-06-05T00:11:14.454+00:00 [gateway] provider auth state pre-warmed in 2504ms eventLoopMax=68.9ms
    2026-06-05T00:11:20.6419568Z stdout F 2026-06-05T00:11:20.641+00:00 [gateway] agent runtime plugins pre-warmed in 5ms

  3. AFabyTWE commented on Jun 5, 2026

    @AFabyTWE
    Author

    I found the issue. Openclaw running in Azure Container Apps leverages an Azure storage account for persistent storage mounted via NFS (for /home/node). Sqlite WAL is not supported on NFS shares. When you update the configuration for the container a new revision is spun up to replace the existing version. This can cause both revisions to use the database at the same time causing it to become corrupted.

    There should be a safe way to deploy openclaw containers in environments like ACA that require an NFS mount for persistent storage.

    For right now I have to stop the container completely and start it again when making changes in order to avoid data corruption.

  4. added a commit that references this issue on Jun 13, 2026
    5b21a03
  5. added a commit that references this issue on Jun 14, 2026
    8dfe65d
  6. added a commit that references this issue on Jun 16, 2026
    c35f666
  7. added a commit that references this issue on Jun 17, 2026
    b8a6ea4
  8. locked as resolved and limited conversation to collaborators on Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingregressionBehavior that previously worked and now fails

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions