FuelLabs/sway · error · anyhow::Error

plugin exit status unknown

Error message

plugin exit status unknown

What it means

When forc dispatches an unknown subcommand to an external plugin (forc-<args>), it runs the binary via plugin::execute_external_subcommand and then propagates the process's exit code with std::process::exit. ExitStatus::code() is None exactly when the process was terminated by a Unix signal rather than exiting normally, so forc cannot map it to an exit code and errors with "plugin exit status unknown".

Source

Thrown at forc/src/cli/mod.rs:157

        Forc::Check(command) => check::exec(command),
        Forc::Clean(command) => clean::exec(command),
        Forc::Completions(command) => completions::exec(command),
        Forc::Init(command) => init::exec(command),
        Forc::New(command) => new::exec(command),
        Forc::ParseBytecode(command) => parse_bytecode::exec(command),
        Forc::Plugins(command) => plugins::exec(command),
        Forc::Test(command) => test::exec(command),
        Forc::Update(command) => update::exec(command),
        Forc::Remove(command) => remove::exec(command),
        Forc::Template(command) => template::exec(command),
        Forc::ContractId(command) => contract_id::exec(command),
        Forc::PredicateRoot(command) => predicate_root::exec(command),
        Forc::Plugin(args) => {
            let output = plugin::execute_external_subcommand(&args)?;
            let code = output
                .status
                .code()
                .ok_or_else(|| anyhow!("plugin exit status unknown"))?;
            std::process::exit(code);
        }
    }
}

View on GitHub (pinned to 47e5e902fa)

Solutions

  1. Run the plugin binary directly (forc-<name> <args>) to see the real signal/crash output without forc's wrapper
  2. Reinstall/upgrade the plugin (fuelup or cargo install) to fix crashes or ABI mismatches
  3. If killed by OOM, reduce memory pressure or the workload size and rerun

Example fix

# before
forc fmt   # crashes with signal, forc reports exit status unknown

# after
forc-fmt      # run directly to observe the crash, then reinstall/upgrade it
Defensive patterns

Strategy: retry

Validate before calling

// Smoke-test the plugin before letting forc dispatch to it.
let status = std::process::Command::new("forc-fmt").arg("--help").status()?;
if !status.success() {
    anyhow::bail!("forc-fmt is not healthy; reinstall before dispatching via forc");
}

Try / catch

let output = std::process::Command::new("forc").args(plugin_args).output()?;
if output.status.code().is_none() {
    // terminated by a signal: rerun the plugin directly to surface the crash
    eprintln!("plugin killed by signal; retrying '{plugin_name}' directly");
    return run_plugin_directly(plugin_name, plugin_args);
}

Prevention

When it happens

Trigger: A forc plugin (forc-wallet, forc-fmt, etc.) crashing or being killed mid-run — SIGSEGV, SIGKILL (OOM killer), abort on panic with panic=abort — when invoked as `forc <plugin-subcommand>`.

Common situations: Plugin killed by the OOM killer, a segfault in a native plugin, Ctrl-C-related signals, or a plugin binary linked against incompatible shared libraries that aborts at startup.

Related errors


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