Skip to content

[Bug]: 2026.6.1 — plugin install index + task registry/flow sidecar migrations fail with "statement.columns is not a function" after upgrade from 2026.5.7 #90007

Closed

Description

@TreyLawrence

Description

After upgrading from 2026.5.7 to 2026.6.1 via openclaw update --yes, the
post-update openclaw doctor step fails. The npm install + global swap succeed;
the doctor verification fails; the gateway is restarted but plugin/task state
stores are broken. The same TypeError: statement.columns is not a function
appears across three independent state migrations.

Environment

  • OS: macOS 25.3.0 (Darwin, arm64)
  • Node: v23.9.0
  • Install method: npm global
  • Previous version: 2026.5.7
  • Target version: 2026.6.1 (latest tag — just promoted from beta)

Steps to reproduce

  1. Have openclaw@2026.5.7 installed globally with state in ~/.openclaw/
  2. Run openclaw backup create
  3. Run openclaw update --dry-run (planned actions look normal)
  4. Run openclaw update --yes

Actual

Update Result: ERROR
  Before: 2026.5.7
  After:  2026.6.1
  Steps:
    ✓ global update (7.09s)
    ✓ global install swap (1.95s)
    ✗ openclaw doctor (2.24s)
        PluginStateStoreError: Failed to open the plugin state database.

openclaw plugins doctor shows the underlying cause:

- Failed migrating plugin install index /Users/<user>/.openclaw/plugins/installs.json:
  TypeError: statement.columns is not a function
- Failed migrating task registry sidecar /Users/<user>/.openclaw/tasks/runs.sqlite:
  TypeError: statement.columns is not a function
- Failed migrating task flow sidecar /Users/<user>/.openclaw/flows/registry.sqlite:
  TypeError: statement.columns is not a function

Workaround

Downgrade to 2026.5.28 — migrations from 2026.5.7 → 2026.5.28 succeed cleanly.

npm install -g openclaw@2026.5.28

Possible cause

statement.columns() is a method on node:sqlite prepared statements
(Node 22.16+/23.x). Node 23.9.0 should have it, so either:

  1. The 2026.6.1 migration code is calling .columns() against a non-node:sqlite
    library (e.g. better-sqlite3 with a different API shape), or
  2. The migration code in 2026.6.1 has a regression vs. 2026.5.28.

Happy to provide more logs or test a patch.

Activity

  1. clawsweeper commented on Jun 3, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 3, 2026, 5:01 PM ET / 21:01 UTC.

    Summary
    Keep open: current main still contains the same source-level hazard on the SQLite/Kysely path used by the reported post-upgrade migrations, and there is no merged fix or duplicate owner in the provided context.

    Reproducibility: yes. from source, but not with a live Node 23.9 run in this checkout. If StatementSync lacks columns(), current main throws the reported TypeError before the affected state migrations can write to SQLite.

    Next step
    This is a narrow, valid repair candidate: the affected helper, migrations, and regression tests are clear, and no product decision is needed unless maintainers want to change the supported Node policy.

    Review details

    Best possible solution:

    Centralize the compatibility fix in the node:sqlite Kysely execution layer or add an early clear runtime guard, then prove the plugin install index and task registry/flow migrations survive the upgrade path without reintroducing JSON runtime storage.

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

    Yes from source, but not with a live Node 23.9 run in this checkout. If StatementSync lacks columns(), current main throws the reported TypeError before the affected state migrations can write to SQLite.

    Is this the best way to solve the issue?

    No implemented solution is present yet. The maintainable repair is a shared SQLite/Kysely compatibility fix or explicit runtime preflight, not three separate migration-specific fallbacks.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • A fix should be verified on a runtime matching the report, or with a focused StatementSync compatibility test, because the local Node 24.16 runtime does expose columns() and therefore does not reproduce the failure by itself.

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

    Label changes

    Label changes:

    • add P1: A reported latest-upgrade regression breaks post-update doctor and leaves plugin/task state migrations failing for a real npm global install.
    • add impact:session-state: The failure is in migration of OpenClaw-owned state stores, including task registry and task flow sidecars, into the shared state database.
    • 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:queueable-fix: Current issue advisory state selects this label.
    • add clawsweeper:fix-shape-clear: Current issue advisory state selects this label.

    Label justifications:

    • P1: A reported latest-upgrade regression breaks post-update doctor and leaves plugin/task state migrations failing for a real npm global install.
    • impact:session-state: The failure is in migration of OpenClaw-owned state stores, including task registry and task flow sidecars, into the shared state database.
    Evidence reviewed

    Acceptance criteria:

    • node scripts/run-vitest.mjs src/infra/kysely-node-sqlite.test.ts src/infra/kysely-sync.types.test.ts src/plugins/installed-plugin-index-store.test.ts src/commands/doctor-state-migrations.test.ts
    • If feasible, run a real openclaw doctor --fix or upgrade-style migration proof on Node 23.9 or the lowest supported Node runtime after the patch.

    What I checked:

    • Current failing call site: executeCompiledSqliteQuerySync unconditionally calls statement.columns() before deciding whether to call all() or run(), so any supported runtime whose node:sqlite statement lacks that method fails before the SQL operation runs. (src/infra/kysely-sync.ts:31, a0717ef61c77)
    • Plugin install index migration routes through shared SQLite: The legacy plugin install index migration now calls readPersistedInstalledPluginIndexSync / writePersistedInstalledPluginIndexSync, and those sync helpers read/write the shared SQLite state store. (src/infra/state-migrations.ts:1484, a0717ef61c77)
    • Task sidecar migrations use the same state DB path: The task registry and task flow sidecar migrations import rows inside runOpenClawStateWriteTransaction, matching two of the reporter's three failing migration warnings. (src/infra/state-migrations.ts:862, a0717ef61c77)
    • Shared state schema also hits the sync helper: Opening the shared state database calls ensureSchema, which uses executeSqliteQuerySync to upsert schema_meta; this makes the statement.columns() dependency part of state DB startup before the affected migrations can complete. (src/state/openclaw-state-db.ts:644, a0717ef61c77)
    • Tests cover happy-path migrations only: Existing tests assert plugin install index and task registry/flow sidecar migration success, but the inspected coverage runs against the available Node runtime and does not simulate a StatementSync without columns(). (src/commands/doctor-state-migrations.test.ts:1230, a0717ef61c77)
    • Regression window: v2026.5.28..HEAD adds src/infra/kysely-sync.ts and moves the installed plugin index from JSON-backed storage into shared SQLite, aligning with the reporter's downgrade-to-2026.5.28 workaround. (src/infra/kysely-sync.ts:1, 4f8740029a0d)

    Likely related people:

    • Ayaan Zaidi: git blame and git log -S point the current sync Kysely helper and the added migration/import paths to commit 4f8740029a, which is the central post-2026.5.28 change implicated by the report. (role: introduced current SQLite migration/helper path; confidence: high; commits: 4f8740029a0d; files: src/infra/kysely-sync.ts, src/infra/state-migrations.ts, src/plugins/installed-plugin-index-store.ts)
    • Peter Steinberger: v2026.5.28 is the reporter's working downgrade target, and history shows that tag as the last local release baseline before the sync helper and SQLite install-index migration changes. (role: adjacent release baseline contributor; confidence: medium; commits: e93216080aa1; files: src/plugins/installed-plugin-index-store.ts, src/infra/kysely-node-sqlite.ts)
    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. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.
    clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.
    on Jun 3, 2026
  3. self-assigned this
    on Jun 3, 2026
  4. added 5 commits that reference this issue on Jun 3, 2026
    a986080
    6ec319a
  5. Countermarch commented on Jun 4, 2026

    @Countermarch
    Contributor

    Additional 2026.6.1 evidence for the plugin install index/shared SQLite migration path, from an upgrade where the migration did not throw statement.columns is not a function but still left doctor in a non-clearable legacy-state warning.

    Environment

    • OpenClaw: 2026.6.1 (2e08f0f)
    • Install path: npm global package update via npm install -g openclaw@2026.6.1
    • Previous stable runtime: 2026.5.28
    • Gateway remained healthy after restart

    Observed behavior

    After the package update and gateway restart, openclaw doctor --lint --json reports:

    {
      "checkId": "core/doctor/legacy-state",
      "severity": "warning",
      "message": "Plugin install index: <stateDir>/plugins/installs.json → shared SQLite state",
      "fixHint": "Run `openclaw doctor --fix` to migrate legacy state."
    }

    Gateway startup/health commands also print:

    Left plugin install index in place because shared SQLite state has conflicting plugin install metadata for: brave, codex
    

    The suggested fix path does not clear the warning:

    openclaw doctor --fix --json
    

    returned exit code 2 with:

    doctor lint options require --lint. Use `openclaw doctor --lint ...`.
    

    Then:

    openclaw doctor --lint --fix --json
    

    returned exit code 1 and still reported the same core/doctor/legacy-state warning.

    Why this seems related

    The original issue covers 2026.6.1 plugin install index migration into shared SQLite failing during upgrade. This is a second failure mode in the same migration/doctor surface:

    • migration detects conflicting global plugin install metadata for brave and codex;
    • it leaves the legacy plugins/installs.json in place;
    • doctor remains ok: false with a fix hint;
    • the hinted fix command either needs different lint flags or does not resolve/report the conflict after those flags are supplied.

    Expected behavior: when the legacy plugin index cannot be safely migrated because shared SQLite state has conflicting plugin metadata, doctor should either clear the warning after a safe migration or report the exact manual/conflict-resolution step instead of leaving a non-clearing Run openclaw doctor --fix hint.

    Additional verification

    • Gateway health after restart remained OK, event loop not degraded, plugin load errors empty.
    • openclaw secrets audit --json gating counts remained clean: plaintext 0, unresolved refs 0, shadowed refs 0.
    • openclaw plugins list --json showed the brave and codex global plugin entries loaded from the local OpenClaw npm plugin directory while the migration continued reporting conflicting metadata.

    Redactions: replaced local absolute paths with <stateDir> and omitted account names, private workspace names, hook URLs, and local user paths.

  6. added a commit that references this issue on Jun 8, 2026
    e4b9ba9
  7. sjf commented on Jun 9, 2026

    @sjf
    Contributor

    Node 23 was EOL'd in 2025, the fix for this issue is to either switch to an LTS version of node (22 or 24), or update to the latest version of node (26).

  8. locked as resolved and limited conversation to collaborators on Jun 11, 2026
  9. added a commit that references this issue on Sep 11, 2026
    f23b84a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions