clockworklabs/SpacetimeDB · error · anyhow::Error

rustfmt is not installed. Please install it.

Error message

rustfmt is not installed. Please install it.

What it means

Error "rustfmt is not installed. Please install it." thrown in clockworklabs/SpacetimeDB.

Source

Thrown at crates/cli/src/tasks/rust.rs:179

            .and_then(|exports| exports.try_contents().ok())
            .is_some_and(|exports| exports.iter().any(check_export))
}

fn has_getrandom(module: &wasmbin::Module) -> bool {
    module
        .find_std_section::<wasmbin::sections::payload::Import>()
        .and_then(|imports| imports.try_contents().ok())
        .is_some_and(|imports| imports.iter().any(|import| import.path.name == "__getrandom_custom"))
}

pub(crate) fn rustfmt(files: impl IntoIterator<Item = PathBuf>) -> anyhow::Result<()> {
    if !has_rust_fmt() {
        if has_rust_up() {
            cmd!("rustup", "component", "add", "rustfmt")
                .run()
                .context("Failed to install rustfmt with Rustup")?;
        } else {
            anyhow::bail!("rustfmt is not installed. Please install it.");
        }
    }
    cmd(
        "rustfmt",
        itertools::chain(
            ["--edition", "2021"].into_iter().map_into::<OsString>(),
            files.into_iter().map_into(),
        ),
    )
    .run()?;
    Ok(())
}

View on GitHub (pinned to 524b4487d9)

When it happens

Trigger: Thrown at crates/cli/src/tasks/rust.rs:179 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16). Data as JSON: /api/errors/9f43c882d73c1630. Report an issue: GitHub.