wasmerio/wasmer · error · anyhow::Error

--experimental-artifact is only supported on Linux

Error message

--experimental-artifact is only supported on Linux

What it means

The --experimental-artifact flag (experimental_artifact in RuntimeOptions) depends on Linux-only profiler tooling, so validate_profiler rejects it at engine-creation time on any other OS. It is a compile-time cfg!(target_os = "linux") gate evaluated at runtime.

Source

Thrown at lib/cli/src/backend.rs:222

}

impl FromStr for Profiler {
    type Err = anyhow::Error;

    fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
        match s.to_lowercase().as_str() {
            "perfmap" => Ok(Self::Perfmap),
            "gdb" => Ok(Self::Gdb),
            "lldb" => Ok(Self::Lldb),
            _ => Err(anyhow::anyhow!("Unrecognized profiler: {s}")),
        }
    }
}

impl RuntimeOptions {
    fn validate_profiler(&self) -> Result<()> {
        if self.experimental_artifact && !cfg!(target_os = "linux") {
            bail!("--experimental-artifact is only supported on Linux");
        }
        if !self.experimental_artifact {
            match self.profiler {
                Some(Profiler::Gdb) => {
                    bail!("The gdb profiler requires --experimental-artifact")
                }
                Some(Profiler::Lldb) => {
                    bail!("The lldb profiler requires --experimental-artifact")
                }
                _ => {}
            }
        }
        Ok(())
    }

    pub fn get_available_backends(&self) -> Result<Vec<BackendType>> {
        // If a specific backend is explicitly requested, use it
        #[cfg(feature = "cranelift")]

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Only pass --experimental-artifact on Linux builds
  2. Gate the flag on target OS in your launcher (cfg!(target_os = "linux") or runtime OS check)
  3. Drop the flag if you do not need the profiler/artifact instrumentation

Example fix

// before
let opts = RuntimeOptions { experimental_artifact: true, .. };
// after
let opts = RuntimeOptions { experimental_artifact: cfg!(target_os = "linux"), .. };
Defensive patterns

Strategy: validation

Validate before calling

if opts.experimental_artifact && !cfg!(target_os = "linux") {
    eprintln!("--experimental-artifact requires Linux; disabling");
    opts.experimental_artifact = false;
}

Type guard

fn can_use_experimental_artifact(opts: &RuntimeOptions) -> bool {
    !opts.experimental_artifact || cfg!(target_os = "linux")
}

Try / catch

match result {
    Err(e) if e.to_string().contains("only supported on Linux") => run_without_artifact(),
    other => other?,
}

Prevention

When it happens

Trigger: Building a RuntimeOptions/engine with experimental_artifact=true on macOS, Windows, or any non-Linux target; get_sys_compiler_config/get_engine call validate_profiler first and bail.

Common situations: Sharing a run script/config between Linux and macOS/Windows dev machines; CI matrix running the same flags cross-platform; enabling the flag by default in a wrapper tool.

Related errors


AI-assisted analysis of wasmerio/wasmer@8c4b9ee9d3 (2026-09-01). Data as JSON: /api/errors/6082dbe71ae94375. Report an issue: GitHub.