{"record":{"id":"abde4da6e6941457","repo":"BigPizzaV3/CodexPlusPlus","slug":"codex-abde4d","errorCode":null,"errorMessage":"Codex 会话数据库缺少必要字段","messagePattern":"Codex 会话数据库缺少必要字段","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/session_share.rs","lineNumber":349,"sourceCode":"    add!(\"source\", source.to_string());\n    add!(\"model_provider\", model_provider.to_string());\n    add!(\"cwd\", cwd);\n    add!(\"title\", title.to_string());\n    add!(\"sandbox_policy\", r#\"{\"type\":\"disabled\"}\"#.to_string());\n    add!(\"approval_mode\", \"never\".to_string());\n    add!(\"tokens_used\", 0_i64);\n    add!(\"has_user_event\", 1_i64);\n    add!(\"archived\", 0_i64);\n    add!(\"cli_version\", cli_version.to_string());\n    add!(\"first_user_message\", first_message.clone());\n    add!(\"thread_source\", thread_source.to_string());\n    add!(\"preview\", first_message);\n    add!(\"history_mode\", history_mode.to_string());\n    add!(\"recency_at\", timestamp);\n    add!(\"recency_at_ms\", timestamp.saturating_mul(1000));\n\n    if !columns.contains(\"id\") || !columns.contains(\"rollout_path\") {\n        bail!(\"Codex 会话数据库缺少必要字段\");\n    }\n    let names = values.iter().map(|(name, _)| *name).collect::<Vec<_>>();\n    let placeholders = (1..=names.len())\n        .map(|index| format!(\"?{index}\"))\n        .collect::<Vec<_>>();\n    let sql = format!(\n        \"INSERT OR REPLACE INTO threads ({}) VALUES ({})\",\n        names.join(\", \"),\n        placeholders.join(\", \")\n    );\n    let params = values\n        .iter()\n        .map(|(_, value)| value.as_ref())\n        .collect::<Vec<_>>();\n    db.execute(&sql, rusqlite::params_from_iter(params))?;\n    Ok(())\n}\n","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/f2074595a281bc057525c748175c8eb9805b0673/crates/codex-plus-core/src/session_share.rs#L331-L367","documentation":"Thrown by register_imported_thread (called from import_rollout) when the Codex session database the importer writes to lacks fields required by the INSERT statement — i.e. the on-disk schema is older or newer than expected. The offending input is the local Codex sessions SQLite schema, not the share payload; the thread row cannot be registered against an incompatible schema.","triggerScenarios":"Thrown at crates/codex-plus-core/src/session_share.rs:349 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["升级 Codex++ 与本机 Codex CLI 版本使数据库 schema 匹配","检查 sessions.db 是否被降级或损坏，必要时备份后重建"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f2074595a281bc057525c748175c8eb9805b0673","analyzedAt":"2026-08-23T12:52:24.489Z","contentChangedAt":"2026-08-23T12:52:24.489Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}