{"record":{"id":"9f43c882d73c1630","repo":"clockworklabs/SpacetimeDB","slug":"rustfmt-is-not-installed-please-install-it","errorCode":null,"errorMessage":"rustfmt is not installed. Please install it.","messagePattern":"rustfmt is not installed\\. Please install it\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/tasks/rust.rs","lineNumber":179,"sourceCode":"            .and_then(|exports| exports.try_contents().ok())\n            .is_some_and(|exports| exports.iter().any(check_export))\n}\n\nfn has_getrandom(module: &wasmbin::Module) -> bool {\n    module\n        .find_std_section::<wasmbin::sections::payload::Import>()\n        .and_then(|imports| imports.try_contents().ok())\n        .is_some_and(|imports| imports.iter().any(|import| import.path.name == \"__getrandom_custom\"))\n}\n\npub(crate) fn rustfmt(files: impl IntoIterator<Item = PathBuf>) -> anyhow::Result<()> {\n    if !has_rust_fmt() {\n        if has_rust_up() {\n            cmd!(\"rustup\", \"component\", \"add\", \"rustfmt\")\n                .run()\n                .context(\"Failed to install rustfmt with Rustup\")?;\n        } else {\n            anyhow::bail!(\"rustfmt is not installed. Please install it.\");\n        }\n    }\n    cmd(\n        \"rustfmt\",\n        itertools::chain(\n            [\"--edition\", \"2021\"].into_iter().map_into::<OsString>(),\n            files.into_iter().map_into(),\n        ),\n    )\n    .run()?;\n    Ok(())\n}\n","sourceCodeStart":161,"sourceCodeEnd":192,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/tasks/rust.rs#L161-L192","documentation":"Error \"rustfmt is not installed. Please install it.\" thrown in clockworklabs/SpacetimeDB.","triggerScenarios":"Thrown at crates/cli/src/tasks/rust.rs:179 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":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}