{"record":{"id":"abd152175870b496","repo":"tinyhumansai/openhuman","slug":"failed-to-query-mcp-writes","errorCode":null,"errorMessage":"failed to query mcp_writes","messagePattern":"failed to query mcp_writes","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/mcp/audit/store.rs","lineNumber":177,"sourceCode":"        let refs = bound\n            .iter()\n            .map(|value| value.as_ref() as &dyn ToSql)\n            .collect::<Vec<_>>();\n        log::trace!(\"[mcp_audit] list_writes preparing query\");\n        let mut stmt = match conn.prepare(&sql) {\n            Ok(stmt) => stmt,\n            Err(err) => {\n                log::warn!(\"[mcp_audit] list_writes prepare failed error={err}\");\n                return Err(anyhow::Error::new(err))\n                    .context(\"failed to prepare mcp_writes list query\");\n            }\n        };\n        log::trace!(\"[mcp_audit] list_writes executing query\");\n        let mapped = match stmt.query_map(refs.as_slice(), row_to_record) {\n            Ok(mapped) => mapped,\n            Err(err) => {\n                log::warn!(\"[mcp_audit] list_writes query failed error={err}\");\n                return Err(anyhow::Error::new(err)).context(\"failed to query mcp_writes\");\n            }\n        };\n        let rows = match mapped.collect::<rusqlite::Result<Vec<_>>>() {\n            Ok(rows) => rows,\n            Err(err) => {\n                log::warn!(\"[mcp_audit] list_writes collect failed error={err}\");\n                return Err(anyhow::Error::new(err)).context(\"failed to collect mcp_writes rows\");\n            }\n        };\n        log::debug!(\"[mcp_audit] list_writes exit rows={}\", rows.len());\n        Ok(rows)\n    });\n    if let Err(err) = &result {\n        log::warn!(\"[mcp_audit] list_writes failed error={err}\");\n    }\n    result\n}\n","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/mcp/audit/store.rs#L159-L195","documentation":"Executing the prepared mcp_writes list query (query_map with the bound limit/offset refs) returned an error from SQLite. Preparation succeeded but execution failed — typically a locked database, a datatype mismatch on a bound parameter, or I/O error mid-query. Wrapped with context 'failed to query mcp_writes' and returned as an error to the listing caller (the MCP audit RPC surface).","triggerScenarios":"Thrown at src/openhuman/mcp/audit/store.rs:177 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the listing once the competing write transaction on the audit DB completes (enable busy_timeout/WAL to avoid lock errors)","Check that bound limit/offset values are within SQLite's integer range","Inspect the underlying SQLite error code in the preceding warn log for the exact cause"],"exampleFix":null,"handlingStrategy":"retry","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-14T05:17:10.506Z"}