xai-org/grok-build · error

refusing to overwrite unreadable MCP preferences at {}

Error message

refusing to overwrite unreadable MCP preferences at {}

What it means

Error "refusing to overwrite unreadable MCP preferences at {}" thrown in xai-org/grok-build.

Source

Thrown at crates/codegen/xai-grok-shell/src/util/config/mcp.rs:455

    match serde_json::from_str(&content) {
        Ok(file) => McpPreferencesLoad::Ok(file),
        Err(e) => {
            tracing::warn!(path = %path.display(), error = %e, "failed to parse MCP preferences");
            McpPreferencesLoad::Corrupt
        }
    }
}

pub(crate) async fn save_mcp_preferences(prefs: &McpPreferencesFile) -> Result<()> {
    save_mcp_preferences_to(&mcp_preferences_path(), prefs).await
}

pub(crate) async fn save_mcp_preferences_to(
    path: &std::path::Path,
    prefs: &McpPreferencesFile,
) -> Result<()> {
    if matches!(load_mcp_preferences_from(path), McpPreferencesLoad::Corrupt) {
        anyhow::bail!(
            "refusing to overwrite unreadable MCP preferences at {}",
            path.display()
        );
    }
    let json = serde_json::to_string_pretty(prefs)?;
    if let Some(parent) = path.parent() {
        tokio::fs::create_dir_all(parent).await?;
    }
    let tmp = path.with_extension(format!(
        "json.tmp.{}{}",
        std::process::id(),
        std::time::SystemTime::now()
            .duration_since(std::time::UNIX_EPOCH)
            .map(|d| d.as_nanos())
            .unwrap_or(0)
    ));
    tokio::fs::write(&tmp, &json).await?;
    #[cfg(unix)]

View on GitHub (pinned to bc7f02eddd)

When it happens

Trigger: Thrown at crates/codegen/xai-grok-shell/src/util/config/mcp.rs:455 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31). Data as JSON: /api/errors/1d9801c3296b2d49. Report an issue: GitHub.