tinyhumansai/openhuman · error · anyhow::Error

open chat.db failed for full-day read

Error message

open chat.db failed for full-day read ({})

What it means

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.

Solutions

  1. Grant Full Disk Access to OpenHuman and restart the app
  2. Confirm the chat.db path is present and the volume is mounted
  3. Retry the scan once access is granted
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at app/src-tauri/src/imessage_scanner/chatdb.rs:114 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/645791ebbcd4d60c. Report an issue: GitHub.

Appendix: source

Thrown at app/src-tauri/src/imessage_scanner/chatdb.rs:114

        out.push(r?);
    }
    Ok(out)
}

/// Read ALL messages for a single `(chat_identifier, day)` slice, inclusive
/// of the day boundary in Apple nanosecond epoch. Used to rebuild full-day
/// transcripts before upserting memory docs — so tick-over-tick we always
/// write the complete conversation for the day, never a partial delta
/// that would overwrite prior content.
pub fn read_chat_day(
    db_path: &Path,
    chat_identifier: &str,
    day_start_apple_ns: i64,
    day_end_apple_ns: i64,
    limit: usize,
) -> anyhow::Result<Vec<Message>> {
    let conn = open(db_path)
        .map_err(|e| anyhow::anyhow!("open chat.db failed for full-day read ({})", e))?;

    let mut stmt = conn.prepare(
        r#"
        SELECT
          m.ROWID            AS rowid,
          m.guid             AS guid,
          m.text             AS text,
          m.attributedBody   AS attributed_body,
          m.date             AS date_ns,
          m.is_from_me       AS is_from_me,
          h.id               AS handle_id,
          c.chat_identifier  AS chat_identifier,
          c.display_name     AS chat_name,
          m.service          AS service
        FROM message m
        LEFT JOIN handle h ON h.ROWID = m.handle_id
        LEFT JOIN chat_message_join cmj ON cmj.message_id = m.ROWID
        LEFT JOIN chat c ON c.ROWID = cmj.chat_id

View on GitHub (pinned to 7491200858)