tinyhumansai/openhuman · error

failed to insert mcp_writes audit row

Error message

failed to insert mcp_writes audit row

What it means

The SQLite INSERT into the mcp_writes audit table failed after serialization succeeded. This is logged as a warning and the record_write call continues — audit persistence is best-effort by design and must not fail the MCP tool call it is auditing. Typical causes: the database file is locked by another connection, the schema is missing/corrupted, or disk is full. The audit row for this write is lost.

Source

Thrown at src/openhuman/mcp/audit/store.rs:78

            params![
                record.timestamp_ms,
                &record.client_info,
                &record.tool_name,
                &args_summary,
                record.resulting_chunk_id.as_deref(),
                if record.success { 1_i64 } else { 0_i64 },
                error_message.as_deref(),
            ],
        ) {
            Ok(_) => {}
            Err(err) => {
                log::warn!(
                    "[mcp_audit] record_write insert failed tool={} client={} timestamp_ms={} error={err}",
                    record.tool_name,
                    record.client_info,
                    record.timestamp_ms
                );
                return Err(anyhow::Error::new(err))
                    .context("failed to insert mcp_writes audit row");
            }
        }
        Ok(conn.last_insert_rowid())
    });
    match &result {
        Ok(row_id) => log::debug!(
            "[mcp_audit] record_write exit row_id={} tool={} client={}",
            row_id,
            record.tool_name,
            record.client_info
        ),
        Err(err) => log::warn!(
            "[mcp_audit] record_write failed tool={} client={} error={err}",
            record.tool_name,
            record.client_info
        ),
    }

View on GitHub (pinned to 7491200858)

Solutions

  1. Check SQLite connectivity and locks — ensure only one process owns the audit DB or enable WAL/busy_timeout
  2. Run the mcp audit schema init/migration to ensure the mcp_writes table matches the insert's columns
  3. Free disk space or repair the audit database file if it is corrupted
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/openhuman/mcp/audit/store.rs:78 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/1487045a2db6d569. Report an issue: GitHub.