FuelLabs/sway · warning · anyhow::Error

Could not get plugin info: {}

Error message

Could not get plugin info: {}

What it means

During `forc plugins`, each executable on PATH matching forc-* is described via get_plugin_info, which wraps format_print_description's ForcResult and prefixes "Could not get plugin info: ". In the current implementation format_print_description always returns Ok, so this wrapper is effectively defensive; the risky part (spawning `<plugin> -h` via .expect) panics rather than producing this error. Historically it fires when formatting a discovered plugin's name/path/description fails.

Source

Thrown at forc/src/cli/commands/plugins.rs:146

    let description = parse_description_for_plugin(&path);

    if describe {
        Ok(format!("  {display} \t\t{description}"))
    } else {
        Ok(display)
    }
}

/// # Panics
///
/// This function assumes that file names will never be empty since it is only used with
/// paths yielded from plugin::find_all(), as well as that the file names are in valid
/// unicode format since file names should be prefixed with `forc-`. Should one of these 2
/// assumptions fail, this function panics.
fn get_plugin_info(path: PathBuf, print_full_path: bool, describe: bool) -> ForcResult<String> {
    format_print_description(path, print_full_path, describe)
        .map_err(|e| anyhow!("Could not get plugin info: {}", e.as_ref()).into())
}

View on GitHub (pinned to 47e5e902fa)

Solutions

  1. Inspect PATH for stray/corrupt forc-* executables and remove or reinstall them (`which -a 'forc-*'` style scan)
  2. Reinstall the offending plugin (cargo install --force or fuelup) so its binary is valid
  3. If a specific plugin crashes on -h, report it — that path currently panics rather than erroring cleanly
Defensive patterns

Strategy: try-catch

Validate before calling

// Before invoking forc plugins, sanity-scan PATH for executables starting with 'forc-'
// and make sure they at least run.
for dir in std::env::split_paths(&std::env::var_os("PATH").unwrap_or_default()) {
    if let Ok(entries) = std::fs::read_dir(dir) {
        for e in entries.flatten() {
            let name = e.file_name();
            if name.to_string_lossy().starts_with("forc-") && !e.path().is_file() { /* skip */ }
        }
    }
}

Try / catch

let output = std::process::Command::new("forc").arg("plugins").output()?;
if !output.status.success() {
    let stderr = String::from_utf8_lossy(&output.stderr);
    if stderr.contains("Could not get plugin info") {
        eprintln!("a forc-* executable on PATH is broken; inspect PATH and reinstall plugins");
    }
    return Err(anyhow::anyhow!("forc plugins failed: {stderr}"));
}

Prevention

When it happens

Trigger: Running `forc plugins` (optionally --paths/--describe) when an executable named forc-* on PATH cannot be formatted — e.g. exotic filenames that break the get_file_name/display assumptions documented in the # Panics note.

Common situations: A broken or half-installed forc- prefixed binary on PATH, or leftover executables with non-unicode names; also note a plugin that crashes on `-h` hits the .expect panic in parse_description_for_plugin instead.

Related errors


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