{"record":{"id":"42b93e02f03168f4","repo":"tinyhumansai/openhuman","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":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/config/migration_helpers/core.rs","lineNumber":175,"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":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/config/migration_helpers/core.rs#L157-L193","documentation":"The OpenClaw sqlite importer introspects the source `memory/brain.db`: key and category columns are picked with fallbacks, but the content column must be one of `content`, `value`, `text`, or `memory` (`pick_optional_column_expr`). If a `memories` table exists yet has none of those columns, the migration bails — the schema is not one it can safely map text out of.","triggerScenarios":"A source brain.db whose `memories` table stores its payload under a different column name — schema drift from another OpenClaw version, a user-built or third-party-generated database, or a table restored from a partial dump with renamed columns.","commonSituations":"Version drift between OpenClaw releases; hand-maintained databases; sqlite files produced by export tools that renamed columns.","solutions":["Inspect the schema (`sqlite3 brain.db \"PRAGMA table_info(memories);\"`) and confirm one of content/value/text/memory exists.","If the payload column is named differently, rename it (`ALTER TABLE memories RENAME COLUMN body TO content;`) or create a view aliasing it to a recognized name, then re-run the migration.","If the db is not genuine OpenClaw data, point the migration at a valid OpenClaw workspace instead."],"exampleFix":"-- before: memories table has payload in `body`\n-- migration bails: no content-like column\n\n-- after: alias the column into a recognized name\nCREATE VIEW memories_importable AS\n  SELECT key AS key, body AS content, category FROM memories;\n-- (or) ALTER TABLE memories RENAME COLUMN body TO content;","handlingStrategy":"validation","validationCode":"// Check the memories table exposes a content-like column before migrating\nlet cols: Vec<String> = conn\n    .prepare(\"PRAGMA table_info(memories)\")?\n    .query_map([], |r| r.get::<_, String>(1))?\n    .collect::<Result<_, _>>()?;\nlet has_content = [\"content\", \"value\", \"text\", \"memory\"]\n    .iter()\n    .any(|c| cols.iter().any(|x| x.eq_ignore_ascii_case(c)));\nif !has_content {\n    // skip the db import and surface a warning instead of failing the migration\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run PRAGMA table_info over third-party sqlite files before importing them","Version-check the source app before migrating its database","Test migrations against a copy of the source db, never the original"],"tags":["migration","openclaw","sqlite","schema-mismatch","introspection"],"backgroundTag":"schema-column-mismatch","analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}