{"record":{"id":"1d9801c3296b2d49","repo":"xai-org/grok-build","slug":"refusing-to-overwrite-unreadable-mcp-preferences-a","errorCode":null,"errorMessage":"refusing to overwrite unreadable MCP preferences at {}","messagePattern":"refusing to overwrite unreadable MCP preferences at (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-shell/src/util/config/mcp.rs","lineNumber":455,"sourceCode":"    match serde_json::from_str(&content) {\n        Ok(file) => McpPreferencesLoad::Ok(file),\n        Err(e) => {\n            tracing::warn!(path = %path.display(), error = %e, \"failed to parse MCP preferences\");\n            McpPreferencesLoad::Corrupt\n        }\n    }\n}\n\npub(crate) async fn save_mcp_preferences(prefs: &McpPreferencesFile) -> Result<()> {\n    save_mcp_preferences_to(&mcp_preferences_path(), prefs).await\n}\n\npub(crate) async fn save_mcp_preferences_to(\n    path: &std::path::Path,\n    prefs: &McpPreferencesFile,\n) -> Result<()> {\n    if matches!(load_mcp_preferences_from(path), McpPreferencesLoad::Corrupt) {\n        anyhow::bail!(\n            \"refusing to overwrite unreadable MCP preferences at {}\",\n            path.display()\n        );\n    }\n    let json = serde_json::to_string_pretty(prefs)?;\n    if let Some(parent) = path.parent() {\n        tokio::fs::create_dir_all(parent).await?;\n    }\n    let tmp = path.with_extension(format!(\n        \"json.tmp.{}{}\",\n        std::process::id(),\n        std::time::SystemTime::now()\n            .duration_since(std::time::UNIX_EPOCH)\n            .map(|d| d.as_nanos())\n            .unwrap_or(0)\n    ));\n    tokio::fs::write(&tmp, &json).await?;\n    #[cfg(unix)]","sourceCodeStart":437,"sourceCodeEnd":473,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-shell/src/util/config/mcp.rs#L437-L473","documentation":"Error \"refusing to overwrite unreadable MCP preferences at {}\" thrown in xai-org/grok-build.","triggerScenarios":"Thrown at crates/codegen/xai-grok-shell/src/util/config/mcp.rs:455 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}