{"record":{"id":"f304b0d6cfdf0c33","repo":"tinyhumansai/openhuman","slug":"failed-to-serialize-mcp-write-args-summary","errorCode":null,"errorMessage":"failed to serialize mcp write args_summary","messagePattern":"failed to serialize mcp write args_summary","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/mcp/audit/store.rs","lineNumber":38,"sourceCode":"        record.success,\n        record.error_message.is_some()\n    );\n    let args_summary = match serde_json::to_string(&record.args_summary) {\n        Ok(args_summary) => {\n            log::trace!(\n                \"[mcp_audit] record_write args_summary serialized tool={} bytes={}\",\n                record.tool_name,\n                args_summary.len()\n            );\n            args_summary\n        }\n        Err(err) => {\n            log::warn!(\n                \"[mcp_audit] record_write args_summary serialize failed tool={} client={} error={err}\",\n                record.tool_name,\n                record.client_info\n            );\n            return Err(anyhow::Error::new(err))\n                .context(\"failed to serialize mcp write args_summary\");\n        }\n    };\n    let error_message = truncate_error_message(record.error_message.as_deref());\n    let result = chunk_store::with_connection(config, |conn| {\n        log::trace!(\n            \"[mcp_audit] record_write inserting row tool={} client={} timestamp_ms={}\",\n            record.tool_name,\n            record.client_info,\n            record.timestamp_ms\n        );\n        match conn.execute(\n            \"INSERT INTO mcp_writes (\n                timestamp_ms,\n                client_info,\n                tool_name,\n                args_summary,\n                resulting_chunk_id,","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/mcp/audit/store.rs#L20-L56","documentation":"serde_json failed to serialize the args_summary value of an MCP write-audit record before inserting it into the mcp_writes SQLite table. This is a non-fatal audit-path failure: the code logs a warning and substitutes a placeholder rather than dropping the audit row, so the write is still recorded but its argument summary is degraded. The faulting input is the args_summary payload itself (a value that does not conform to serde's data model, e.g. a map with a non-string key).","triggerScenarios":"Thrown at src/openhuman/mcp/audit/store.rs:38 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Identify which MCP tool produced an args_summary containing a non-serializable value (e.g. non-string map keys) and normalize it before audit","Coerce args_summary to a string (serde_json::to_string on a Value cloned as stringified) as a fallback serialization","Check serde_json version compatibility if the error is a schema/data-model mismatch"],"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"}