{"record":{"id":"645791ebbcd4d60c","repo":"tinyhumansai/openhuman","slug":"open-chat-db-failed-for-full-day-read","errorCode":null,"errorMessage":"open chat.db failed for full-day read ({})","messagePattern":"open chat\\.db failed for full-day read \\((.+?)\\)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"app/src-tauri/src/imessage_scanner/chatdb.rs","lineNumber":114,"sourceCode":"        out.push(r?);\n    }\n    Ok(out)\n}\n\n/// Read ALL messages for a single `(chat_identifier, day)` slice, inclusive\n/// of the day boundary in Apple nanosecond epoch. Used to rebuild full-day\n/// transcripts before upserting memory docs — so tick-over-tick we always\n/// write the complete conversation for the day, never a partial delta\n/// that would overwrite prior content.\npub fn read_chat_day(\n    db_path: &Path,\n    chat_identifier: &str,\n    day_start_apple_ns: i64,\n    day_end_apple_ns: i64,\n    limit: usize,\n) -> anyhow::Result<Vec<Message>> {\n    let conn = open(db_path)\n        .map_err(|e| anyhow::anyhow!(\"open chat.db failed for full-day read ({})\", e))?;\n\n    let mut stmt = conn.prepare(\n        r#\"\n        SELECT\n          m.ROWID            AS rowid,\n          m.guid             AS guid,\n          m.text             AS text,\n          m.attributedBody   AS attributed_body,\n          m.date             AS date_ns,\n          m.is_from_me       AS is_from_me,\n          h.id               AS handle_id,\n          c.chat_identifier  AS chat_identifier,\n          c.display_name     AS chat_name,\n          m.service          AS service\n        FROM message m\n        LEFT JOIN handle h ON h.ROWID = m.handle_id\n        LEFT JOIN chat_message_join cmj ON cmj.message_id = m.ROWID\n        LEFT JOIN chat c ON c.ROWID = cmj.chat_id","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/app/src-tauri/src/imessage_scanner/chatdb.rs#L96-L132","documentation":"The full-day transcript rebuild (read_chat_day) could not open chat.db at all, so no messages for the (chat_identifier, day) slice can be read and the upsert of the complete-day conversation is aborted.","triggerScenarios":"Thrown at app/src-tauri/src/imessage_scanner/chatdb.rs:114 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Grant Full Disk Access to OpenHuman and restart the app","Confirm the chat.db path is present and the volume is mounted","Retry the scan once access is granted"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}