Skip to content

Memory vector database opens in readonly mode, blocking all writes #19167

@marliechorgan

Description

@marliechorgan

Memory vector database opens in readonly mode, blocking all writes

Summary

The memory vector database (memory-vectors.db) consistently opens with SQLITE_OPEN_READONLY mode, preventing all write operations. This breaks memory indexing entirely - no new files can be indexed, and the memory system is frozen at whatever state existed before the bug manifested.

Environment

  • OpenClaw version: 2026.2.13 (stable channel)
  • OS: macOS 14.2.0 (arm64)
  • Node: v22.22.0
  • Database: SQLite 3.x with sqlite-vec extension
  • Embedding provider: local (embeddinggemma-300m-qat-Q8_0)

Reproduction

  1. Configure memory search with local embeddings:
{
  "agents": {
    "defaults": {
      "memorySearch": {
        "enabled": true,
        "provider": "local",
        "store": {
          "driver": "sqlite",
          "path": "~/.openclaw/memory-vectors.db"
        }
      }
    }
  }
}
  1. Start gateway: openclaw gateway start

  2. Observe logs: tail -f /tmp/openclaw/openclaw-*.log | grep memory

  3. See repeated errors:

[memory] sync failed (session-delta): Error: attempt to write a readonly database
[memory] sync failed (interval): Error: attempt to write a readonly database

Evidence

File permissions are correct

$ ls -la ~/.openclaw/memory-vectors.db
-rw-rw-rw-  1 user  staff  24530944 Feb 17 14:24 memory-vectors.db

Database is not readonly at SQLite level

$ sqlite3 ~/.openclaw/memory-vectors.db "PRAGMA query_only;"
0

Fresh database still fails

After deleting the database and restarting gateway, a new 69KB database is created, but immediately fails with the same readonly error on first write attempt.

Expected behavior

Database should open with SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE flags, allowing:

  • Memory file indexing (MEMORY.md, memory/*.md)
  • Session transcript indexing
  • File watcher updates
  • Periodic sync operations

Actual behavior

Database opens with SQLITE_OPEN_READONLY flag, causing:

  • ❌ All write operations fail with "attempt to write a readonly database"
  • ❌ Memory indexing completely broken
  • ❌ File count frozen (no new files added)
  • ❌ Session transcripts not indexed
  • ❌ Cross-agent memory sharing impossible

Impact

Critical - Core memory system is non-functional. Users may not notice immediately (silent failure), but memory search will never include new content.

Suspected root cause

SQLite connection initialization in memory plugin (likely memory-core) opens with wrong flags:

// Current (wrong):
const db = sqlite.open({
  filename: dbPath,
  mode: sqlite.SQLITE_OPEN_READONLY  // ❌
});

// Should be:
const db = sqlite.open({
  filename: dbPath,
  mode: sqlite.SQLITE_OPEN_READWRITE | sqlite.SQLITE_OPEN_CREATE  // ✅
});

Workaround

None currently available. Memory search still works on existing indexed data, but no new content can be added.

Additional context

  • Issue is 100% reproducible on macOS 14.2.0 (arm64)
  • File/directory permissions verified correct (666/755)
  • Process ownership verified (same user)
  • Happens on both fresh and existing databases
  • May affect other users silently (memory system appears to work but never updates)

Reporter: OpenClaw user via main agent
Date: 2026-02-17
Priority: Critical - core functionality broken

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleMarked as stale due to inactivity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions