-
Notifications
You must be signed in to change notification settings - Fork 551
Description
Summary
After upgrading from the legacy memory-lancedb plugin to memory-lancedb-pro@1.1.0-beta.9, all CLI commands that touch the memory store (memory-pro stats, memory-pro export, memory-pro migrate run) fail with:
LanceError(Schema): Schema error: No field named scope. Valid fields are category.
The plugin loads successfully and config validates cleanly — the failure happens at the first query against the existing table.
Root Cause
In src/store.ts, doInitialize() detects the missing scope column but only logs a warning — it never actually adds the column:
// src/store.ts ~line 229-238
const sample = await table.query().limit(1).toArray();
if (sample.length > 0 && !("scope" in sample[0])) {
console.warn(
"Adding scope column for backward compatibility with existing data",
);
// ⚠️ BUG: warning is logged but no ALTER TABLE / addColumns() is called here
}Every subsequent query that selects scope then fails because the column doesn't exist in the Arrow schema. This affects:
memory-pro stats→ callsquery().select(["scope", "category"])memory-pro export→ same failurememory-pro migrate run→ reads fine, butimportEntry()tries totable.add([{...scope: "global"...}])into a table without that column
Reproduction Steps
- Have an existing
memory-lancedb(legacy) database at~/.openclaw/memory/lancedb - Install
memory-lancedb-pro@1.1.0-beta.9 - Configure
plugins.slots.memory: "memory-lancedb-pro" - Run
openclaw memory-pro stats
Expected: Statistics showing migrated memories
Actual:
Adding scope column for backward compatibility with existing data
Failed to get statistics: [Error: Failed to execute query stream: GenericFailure,
lance error: LanceError(Schema): Schema error: No field named scope.
Valid fields are category., ...]
Table Schema (Legacy)
id, text, vector, importance, category, createdAt
Table Schema (Expected by memory-lancedb-pro)
id, text, vector, category, scope, importance, timestamp, metadata
Workaround (Python)
Until this is fixed in the plugin, the column can be added directly via Python's lancedb:
import lancedb
db = lancedb.connect("/Users/<you>/.openclaw/memory/lancedb")
tbl = db.open_table("memories")
# Check if fix needed
schema_fields = [f.name for f in tbl.schema]
if "scope" not in schema_fields:
tbl.add_columns({"scope": "cast('global' as string)"})
print(f"Fixed: added scope column to {tbl.count_rows()} rows")After running this, openclaw memory-pro stats works correctly and returns all 617 memories.
Suggested Fix
In src/store.ts, replace the no-op warning with an actual addColumns call:
const sample = await table.query().limit(1).toArray();
if (sample.length > 0 && !("scope" in sample[0])) {
console.warn(
"Adding scope column for backward compatibility with existing data",
);
// Fix: actually add the column instead of just warning
try {
await (table as any).addColumns([
{ name: "scope", valueSql: "'global'" }
]);
console.log("memory-lancedb-pro: scope column added successfully");
} catch (alterErr) {
console.warn("memory-lancedb-pro: failed to add scope column:", alterErr);
}
}Note: the exact LanceDB JS API for addColumns may need verification — the Python API uses add_columns({"scope": "cast('global' as string)"}) which worked correctly.
Impact
- Severity: Critical — blocks all memory operations on any existing installation upgrading from legacy plugin
- Affected versions:
memory-lancedb-pro@1.1.0-beta.9(likely all 1.1.0-beta.x) - Not affected: Fresh installs with no prior
memory-lancedbdata (table created with correct schema from the start)
Environment
- OpenClaw: 2026.3.22 (4dcc39c)
- memory-lancedb-pro: 1.1.0-beta.9
- Node.js: v25.4.0
- macOS (Apple Silicon)
- LanceDB Python: 0.29.1 (used for workaround)