{"record":{"id":"cd13a0fddd1171b9","repo":"tinyhumansai/openhuman","slug":"failed-to-collect-mcp-writes-rows","errorCode":null,"errorMessage":"failed to collect mcp_writes rows","messagePattern":"failed to collect mcp_writes rows","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/mcp/audit/store.rs","lineNumber":184,"sourceCode":"            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\nfn normalized_limit(limit: Option<u64>) -> Result<i64> {\n    u64_to_i64(\n        limit.unwrap_or(DEFAULT_LIST_LIMIT).min(MAX_LIST_LIMIT),\n        \"limit\",\n    )\n}\n","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/mcp/audit/store.rs#L166-L202","documentation":"query_map succeeded but iterating the resulting row iterator (mapped rows / row_to_record conversion) failed while collecting mcp_writes rows. This is the 'failed to collect mcp_writes rows' context: an individual row could not be converted to the audit record type — usually a schema/value mismatch (unexpected NULL in a non-optional column, or an integer where a string is expected) rather than a query failure.","triggerScenarios":"Thrown at src/openhuman/mcp/audit/store.rs:184 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the failing row's columns for NULLs or type mismatches against the record struct's FromSql expectations","Make row_to_record tolerant (default/Option handling) for legacy rows written by an older schema","If the table contains malformed legacy rows, migrate or vacuum the audit database"],"exampleFix":null,"handlingStrategy":"fallback","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"}