{"record":{"id":"1487045a2db6d569","repo":"tinyhumansai/openhuman","slug":"failed-to-insert-mcp-writes-audit-row","errorCode":null,"errorMessage":"failed to insert mcp_writes audit row","messagePattern":"failed to insert mcp_writes audit row","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/mcp/audit/store.rs","lineNumber":78,"sourceCode":"            params![\n                record.timestamp_ms,\n                &record.client_info,\n                &record.tool_name,\n                &args_summary,\n                record.resulting_chunk_id.as_deref(),\n                if record.success { 1_i64 } else { 0_i64 },\n                error_message.as_deref(),\n            ],\n        ) {\n            Ok(_) => {}\n            Err(err) => {\n                log::warn!(\n                    \"[mcp_audit] record_write insert failed tool={} client={} timestamp_ms={} error={err}\",\n                    record.tool_name,\n                    record.client_info,\n                    record.timestamp_ms\n                );\n                return Err(anyhow::Error::new(err))\n                    .context(\"failed to insert mcp_writes audit row\");\n            }\n        }\n        Ok(conn.last_insert_rowid())\n    });\n    match &result {\n        Ok(row_id) => log::debug!(\n            \"[mcp_audit] record_write exit row_id={} tool={} client={}\",\n            row_id,\n            record.tool_name,\n            record.client_info\n        ),\n        Err(err) => log::warn!(\n            \"[mcp_audit] record_write failed tool={} client={} error={err}\",\n            record.tool_name,\n            record.client_info\n        ),\n    }","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/mcp/audit/store.rs#L60-L96","documentation":"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.","triggerScenarios":"Thrown at src/openhuman/mcp/audit/store.rs:78 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check SQLite connectivity and locks — ensure only one process owns the audit DB or enable WAL/busy_timeout","Run the mcp audit schema init/migration to ensure the mcp_writes table matches the insert's columns","Free disk space or repair the audit database file if it is corrupted"],"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-14T00:17:10.932Z"}