{"record":{"id":"49983f7e8869b2fa","repo":"zeroclaw-labs/zeroclaw","slug":"openclaw-memories-table-found-but-no-content-like","errorCode":null,"errorMessage":"OpenClaw memories table found but no content-like column was detected","messagePattern":"OpenClaw memories table found but no content-like column was detected","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-runtime/src/migration.rs","lineNumber":193,"sourceCode":"\n    let table_exists: Option<String> = conn\n        .query_row(\n            \"SELECT name FROM sqlite_master WHERE type='table' AND name='memories' LIMIT 1\",\n            [],\n            |row| row.get(0),\n        )\n        .optional()?;\n\n    if table_exists.is_none() {\n        return Ok(Vec::new());\n    }\n\n    let columns = table_columns(&conn, \"memories\")?;\n    let key_expr = pick_column_expr(&columns, &[\"key\", \"id\", \"name\"], \"CAST(rowid AS TEXT)\");\n    let Some(content_expr) =\n        pick_optional_column_expr(&columns, &[\"content\", \"value\", \"text\", \"memory\"])\n    else {\n        bail!(\"OpenClaw memories table found but no content-like column was detected\");\n    };\n    let category_expr = pick_column_expr(&columns, &[\"category\", \"kind\", \"type\"], \"'core'\");\n\n    let sql = format!(\n        \"SELECT {key_expr} AS key, {content_expr} AS content, {category_expr} AS category FROM memories\"\n    );\n\n    let mut stmt = conn.prepare(&sql)?;\n    let mut rows = stmt.query([])?;\n\n    let mut entries = Vec::new();\n    let mut idx = 0_usize;\n\n    while let Some(row) = rows.next()? {\n        let key: String = row\n            .get(0)\n            .unwrap_or_else(|_| format!(\"openclaw_sqlite_{idx}\"));\n        let content: String = row.get(1).unwrap_or_default();","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-runtime/src/migration.rs#L175-L211","documentation":"When the migration source contains a SQLite database with a memories table, read_openclaw_sqlite_entries inspects its columns via PRAGMA table_info(memories). It picks a key expression (key/id/name, else rowid) and then requires one content-bearing column among content, value, text, or memory. If none of those exist the schema is unrecognized and it bails rather than importing garbage.","triggerScenarios":"Migrating an OpenClaw database from a fork or a version whose memories table uses a different content column name; a database where the content column was renamed or dropped; a memories table created by unrelated software inside the source workspace; a truncated/partially-migrated DB.","commonSituations":"Schema drift between OpenClaw versions; users pointing --source at a directory that merely looks like an OpenClaw workspace; databases restored from backups with later manual ALTERs.","solutions":["Inspect the actual schema: sqlite3 source.db 'PRAGMA table_info(memories);' and find which column holds the memory text","Rename it to a recognized name: ALTER TABLE memories RENAME COLUMN <old> TO content; (SQLite 3.25+)","If the schema is from an unsupported OpenClaw version, export rows to JSON/text and import into ZeroClaw memories manually","Verify you pointed --source at a genuine OpenClaw workspace"],"exampleFix":"-- before: memories(body TEXT, key TEXT)\nALTER TABLE memories RENAME COLUMN body TO content;\n-- after: memories(content TEXT, key TEXT) — migration proceeds","handlingStrategy":"validation","validationCode":"let conn = Connection::open(&db_path)?;\nlet cols: Vec<String> = table_columns(&conn, \"memories\")?;\nlet has_content = [\"content\", \"value\", \"text\", \"memory\"].iter().any(|c| cols.iter().any(|x| x == c));\nif !has_content {\n    // tell the user which columns exist and suggest ALTER TABLE ... RENAME COLUMN\n}","typeGuard":null,"tryCatchPattern":"Err(e) if e.to_string().contains(\"no content-like column\") => {\n    // inspect PRAGMA table_info(memories) with the user; unsupported schema — do not retry unchanged\n}","preventionTips":["Pre-flight the source DB schema before starting a migration","Pin supported OpenClaw versions and validate their schema in a test matrix","Back up the source DB before any ALTER TABLE workaround"],"tags":["rust","zeroclaw","migration","sqlite","schema","openclaw"],"backgroundTag":"missing-database-column","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}