wasmerio/wasmer · error · anyhow::Error

The gdb profiler requires --experimental-artifact

Error message

The gdb profiler requires --experimental-artifact

What it means

The gdb profiler can only operate when the experimental artifact machinery is enabled, because it needs the instrumented artifact. validate_profiler enforces the inverse of error 223: if experimental_artifact is false and profiler == Gdb, it bails.

Source

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

    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")]
        {
            if self.cranelift {
                return Ok(vec![BackendType::Cranelift]);
            }
        }

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Add --experimental-artifact alongside --profile gdb
  2. Set RuntimeOptions.experimental_artifact = true when selecting Profiler::Gdb
  3. Remove the gdb profiler option if profiling is not intended

Example fix

// before
let opts = RuntimeOptions { profiler: Some(Profiler::Gdb), experimental_artifact: false, .. };
// after
let opts = RuntimeOptions { profiler: Some(Profiler::Gdb), experimental_artifact: true, .. };
Defensive patterns

Strategy: validation

Validate before calling

if matches!(opts.profiler, Some(Profiler::Gdb)) && !opts.experimental_artifact {
    eprintln!("gdb profiler needs --experimental-artifact; enabling");
    opts.experimental_artifact = true;
}

Type guard

fn profiler_config_valid(opts: &RuntimeOptions) -> bool {
    !matches!(opts.profiler, Some(Profiler::Gdb | Profiler::Lldb)) || opts.experimental_artifact
}

Try / catch

match result {
    Err(e) if e.to_string().contains("requires --experimental-artifact") => retry_with_artifact_flag(),
    other => other?,
}

Prevention

When it happens

Trigger: Passing Profiler::Gdb (or --profile gdb) without also setting experimental_artifact / --experimental-artifact, when get_sys_compiler_config or get_engine builds the engine.

Common situations: Running `wasmer run --profile gdb` without the flag; scripts updated for gdb profiling but missing the experimental flag; docs showing only the profiler flag.

Related errors


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