Skip to content

Memory store unavailable — database wiped on gateway restart, startup checks never log #491

@DSchexy

Description

@DSchexy

Bug Description

The memory-lancedb-pro plugin registers successfully but shows "unavailable" status. The LanceDB database appears to be wiped on every gateway restart, and the startup checks never produce any log output.

Environment

  • OpenClaw version: 2026.3.23-2 (gateway managed as standalone process)
  • Plugin version: 1.0.32 (npm global install) — also tested 1.1.0-beta.9
  • LanceDB version: @lancedb/lancedb 1.x
  • Embedding model: nomic-embed-text (768 dims, Ollama local)
  • OS: macOS 25.3.0 (arm64)
  • Node: v22.22.1
  • Database path: /Users/luna/.openclaw/memory/lancedb-pro

Steps to Reproduce

  1. Install memory-lancedb-pro globally: `npm install -g memory-lancedb-pro`
  2. Configure in OpenClaw config with LanceDB path + Ollama embeddings
  3. Start gateway — plugin registers ("memory-lancedb-pro@X.X.X: plugin registered" appears in logs)
  4. Run `openclaw status` — Memory shows "unavailable"
  5. Check `~/.openclaw/memory/lancedb-pro/` — directory exists but is empty (no memories.lance)
  6. Manually create LanceDB tables — tables exist, data is present
  7. Restart gateway — database is wiped again, status returns to "unavailable"

Expected Behavior

  • Plugin should initialize LanceDB on first start without wiping existing data on restart
  • Startup checks should log either "initialized successfully" or "startup checks failed" with error details
  • Memory status should show "available" once tables are created

Actual Behavior

  1. Empty database on first start: Plugin creates the directory structure (memories.lance/ with _transactions/, _versions/, data/) but never creates the actual .lance table files
  2. No startup check logs: Despite `setTimeout(() => void runStartupChecks(), 0)` being called in the register() function, no "initialized successfully" or "startup checks failed" messages appear in OpenClaw logs
  3. Database wiped on restart: When gateway restarts, the entire memories.lance directory is cleared
  4. Status always "unavailable": The OpenClaw doctor.memory.status probe consistently returns unavailable

Manual Workaround Attempted

I manually created the LanceDB tables using the plugin's exact schema:

const schemaEntry = {
  id: '__schema__',
  text: '',
  vector: Array(768).fill(0),  // nomic-embed-text = 768 dims
  category: 'other',
  scope: 'global',
  importance: 0,
  timestamp: 0,
  metadata: '{}'
};

The table was created successfully with .lance data files present. But on gateway restart, the database was wiped again.

Diagnosis

The symptoms suggest one of these issues:

  1. Silent initialization failure: The MemoryStore.doInitialize() may be failing silently — possibly due to the delete('id = "schema"') call (which throws "not yet implemented" in this LanceDB version). But this error should be caught and logged, and it isn't.

  2. Fire-and-forget timing issue: The `runStartupChecks()` is scheduled via `setTimeout(..., 0)` (fire-and-forget). If the plugin's internal health check runs before the startup checks complete, it sees an uninitialized store and marks the plugin unavailable. The startup check logging may also be going to a different log sink than OpenClaw's main logs.

  3. Database wipe on restart: There may be code in the plugin or OpenClaw core that clears the LanceDB database directory on startup under certain conditions.

Plugin Config Used

{
  "embedding": {
    "apiKey": "${OPENAI_API_KEY}",
    "model": "nomic-embed-text",
    "baseURL": "http://localhost:11434/v1",
    "dimensions": 768,
    "chunking": true
  },
  "autoCapture": true,
  "autoRecall": false,
  "dbPath": "/Users/luna/.openclaw/memory/lancedb-pro",
  "retrieval": {
    "mode": "hybrid",
    "rerank": "none",
    "vectorWeight": 0.7,
    "bm25Weight": 0.3,
    "minScore": 0.3
  }
}

Questions

  • Is there a `delete` operation on the database directory in the plugin or OpenClaw core on startup?
  • Should the `runStartupChecks()` logging go through a different sink than `api.logger`?
  • Is there a known incompatibility with the parameterized delete syntax `delete('id = ?', [value])` in certain LanceDB versions?

Request

  • Fix the database wipe on restart
  • Ensure startup check errors are properly logged
  • Add more verbose logging to doInitialize() to surface silent failures

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions