Skip to content

[Bug]: memory_search intermittently returns "database is not open" on healthy index in 2026.7.1 #108068

Closed

Description

@aaajiao

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

On OpenClaw 2026.7.1, in-gateway memory_search intermittently returned disabled/unavailable with database is not open while the same builtin SQLite index passed PRAGMA quick_check, deep status reported a valid/ready index, and a non-force incremental index restored search without a Gateway restart.

Steps to reproduce

NOT_ENOUGH_INFO

Expected behavior

memory_search should query the healthy builtin index without returning disabled/unavailable. After a non-force incremental index, the same tool and CLI search path returned results against the same database without a Gateway restart.

Actual behavior

A memory_search call returned:

{
  "results": [],
  "disabled": true,
  "unavailable": true,
  "error": "database is not open",
  "warning": "Memory search is unavailable due to an embedding/provider error.",
  "action": "Check embedding provider configuration and retry memory_search."
}

Immediate inspection found no SQLite corruption or unavailable search component. A non-force openclaw memory index --agent main restored both tool-side and CLI search.

OpenClaw version

2026.7.1 (2d2ddc4)

Operating system

Linux 7.0.11-orbstack-00360-gc9bc4d96ac70 (arm64)

Install method

npm global package (/usr/lib/node_modules/openclaw)

Model

Agent: openai/gpt-5.6-sol; memory embeddings: openai/text-embedding-3-small

Provider / routing chain

OpenClaw builtin memory-core -> OpenAI embeddings (text-embedding-3-small)

Additional provider/model setup details

Builtin memory backend with memory and sessions sources plus workspace docs as an extra path. The OpenAI embedding probe passed during openclaw memory status --deep --index --json immediately after the failure.

Logs

# Failed in-gateway tool call
error: database is not open
disabled: true
unavailable: true

# State inspected immediately afterward
OpenClaw: 2026.7.1 (2d2ddc4)
SQLite size: approximately 1.1 GB
PRAGMA quick_check: ok
PRAGMA journal_mode: wal
WAL checkpoint: 0|0|0
Index at failure: 1932/1933 files
Deep status: index identity valid; embedding probe ok; FTS ready;
             sqlite-vec store available; semantic search available

# Non-force recovery
openclaw memory index --agent main
Memory index updated (main).

# State after recovery
Indexed: 1933/1933 files
Chunks: 12010
CLI search: successful
Three subsequent in-gateway memory_search calls: successful
Gateway restart: not performed
Full/force rebuild: not performed

Screenshots, recordings, and evidence

The source Markdown files remained intact. The same approximately 1.1 GB SQLite file passed quick_check; no database replacement, full rebuild, or Gateway restart was needed. Search recovered after the non-force incremental index.

Impact and severity

Affected: builtin memory-core recall in the main agent.

Severity: medium; the failed call blocks semantic/keyword recall until a manual incremental index is run.

Frequency: intermittent. A deterministic trigger was not identified.

Consequence: recall-dependent workflows fail for the affected call. No corruption or data loss was observed.

Additional information

This is a fresh latest-release occurrence of the closed-handle symptom family previously reported in #18083 and #77781. It is not the sqlite-vec-unavailable variant from #77781: deep status reported sqlite-vec store and semantic search available. #18083 was closed with a request to open a new issue if the symptom still occurs on the latest release.

Last known good version / first known bad version: NOT_ENOUGH_INFO

Activity

  1. 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: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    on Jul 16, 2026
  2. clawsweeper commented on Jul 16, 2026

    @clawsweeper
    Contributor

    Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

    Close as implemented on current main. The memory-core tool now recognizes the reported closed SQLite-handle error, reacquires the memory manager, and retries the same search; focused regression coverage uses the exact database is not open symptom and verifies a successful second search. The fix is newer than v2026.7.1, so affected operators need the next release containing current main.

    So I’m closing this as already implemented rather than keeping a duplicate issue open.

    Review details

    Best possible solution:

    Keep the current one-shot closed-handle recovery on main and include it in the next release so released installations no longer need an incremental index command to recover this symptom.

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

    No current-main failure reproduction was established because the checked-in tool path now catches the exact closed-handle message and retries. The release report plus exact focused regression coverage provide high-confidence source evidence for the former behavior and its recovery.

    Is this the best way to solve the issue?

    Yes. Retrying once at the memory tool boundary after reacquiring the manager is the narrowest maintainable fix: it preserves the healthy index and avoids requiring a gateway restart or operator-run index command.

    Security review:

    Security review: No pull-request patch is under review; the issue reports availability of local memory search rather than a security boundary concern.

    AGENTS.md: found and applied where relevant.

    What I checked:

    • Current-main recovery path: The tool catches closed-store messages including database is not open, reacquires the manager context, and repeats the original search rather than returning the unavailable result. (extensions/memory-core/src/tools.ts:687, 642ded397bc1)
    • Regression coverage: Focused coverage simulates a first search throwing database is not open; it expects a result after two searches and two manager acquisitions, matching the reported healthy-index recovery case. (extensions/memory-core/src/tools.test.ts:750, 642ded397bc1)
    • Fresh manager lifecycle: For ordinary tool searches, a cached manager that is closing or closed is not exempted from scope cleanup before the manager is returned again, so the retry does not intentionally retain a closed cached instance. (extensions/memory-core/src/memory/manager.ts:605, 642ded397bc1)
    • Fix provenance: git blame attributes the closed-store retry lines to commit 642ded397bc1b8ffb89543728c79d109b7c8cdc6; git log -S'isClosedMemoryStoreError' identifies the same commit as the introduction point. (extensions/memory-core/src/tools.ts:690, 642ded397bc1)
    • Current-main-only release provenance: The fix commit is an ancestor of the checked-out main, while git tag --contains 642ded397bc1b8ffb89543728c79d109b7c8cdc6 returned no release tag and the v2026.7.1 ancestry check was negative. It is therefore fixed on main but not proven shipped in v2026.7.1. (extensions/memory-core/src/tools.ts:687, 642ded397bc1)
    • Maturity classification: The maturity helper classifies the primary owner as session-memory, which is M3 Beta and therefore not eligible for maturity:stable. (qa/maturity-scores.yaml, 642ded397bc1)

    Likely related people:

    • Vincent Koc: Git blame assigns both the closed-store retry and its manager reacquisition path to the current-main proof commit. (role: introduced current recovery behavior; confidence: high; commits: 642ded397bc1; files: extensions/memory-core/src/tools.ts, extensions/memory-core/src/tools.test.ts)
    • steipete: Feature-history shortlog shows the strongest contribution history across the memory tool, manager, and search-manager surfaces inspected for this review. (role: long-running adjacent contributor; confidence: medium; files: extensions/memory-core/src/tools.ts, extensions/memory-core/src/memory/manager.ts, extensions/memory-core/src/memory/search-manager.ts)

    Codex review notes: model internal, reasoning high; reviewed against 4a8ce9c3365b; fix evidence: commit 642ded397bc1, main fix timestamp 2026-07-31T22:28:20+08:00.

  3. added
    issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.
    clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.
    and removed
    issue-rating: 🦪 silver shellfishThin issue quality; more reproduction proof or environment detail is needed.
    on Jul 30, 2026
  4. steipete commented on Aug 3, 2026

    @steipete
    Contributor

    Fixed after the affected v2026.7.1 release by #113471. The search retry already existed in v2026.7.1, but its cache could hand that retry the same closing or closed SQLite-backed memory manager. The shared manager owner now retires closing/closed cache entries, serializes teardown with reacquisition, and creates a fresh manager. Regressions cover both the concurrent close/reacquire race and the exact database is not open retry. Available in v2026.7.2-beta.6 and later.

  5. locked as resolved and limited conversation to collaborators on Oct 22, 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

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-infoClawSweeper needs more reporter information before it can verify this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦐 gold shrimpDecent issue quality, but reproduction details are still incomplete.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions