FuelLabs/sway · error · anyhow::Error

{err}

Error message

{err}

What it means

Error "{err}" thrown in FuelLabs/sway.

Source

Thrown at forc-plugins/forc-fmt/src/main.rs:86

        println_error(&format!("{err}"));
        std::process::exit(1);
    }
}

fn run() -> Result<()> {
    let app = App::parse();

    let dir = match app.path.as_ref() {
        Some(path) => PathBuf::from(path),
        None => std::env::current_dir()?,
    };

    let experimental = ExperimentalFeatures::new(
        &HashMap::default(),
        &app.experimental.experimental,
        &app.experimental.no_experimental,
    )
    .map_err(|err| anyhow::anyhow!("{err}"))?;

    let mut formatter = Formatter::from_dir(&dir, experimental)?;
    if let Some(f) = app.file.as_ref() {
        let file_path = &PathBuf::from(f);

        if is_sway_file(file_path) {
            format_file(&app, file_path.to_path_buf(), &mut formatter)?;
            return Ok(());
        }

        bail!(
            "Provided file '{}' is not a valid Sway file",
            file_path.display()
        );
    };

    let manifest_file = forc_pkg::manifest::ManifestFile::from_dir(&dir)?;
    match manifest_file {

View on GitHub (pinned to 47e5e902fa)

When it happens

Trigger: Thrown at forc-plugins/forc-fmt/src/main.rs:86 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of FuelLabs/sway@47e5e902fa (2026-08-16). Data as JSON: /api/errors/6c4761c8c0a3176f. Report an issue: GitHub.