{"record":{"id":"d70382bd1ac8ee91","repo":"wasmerio/wasmer","slug":"the-gdb-profiler-requires-experimental-artifact","errorCode":null,"errorMessage":"The gdb profiler requires --experimental-artifact","messagePattern":"The gdb profiler requires --experimental-artifact","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"lib/cli/src/backend.rs","lineNumber":227,"sourceCode":"    fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {\n        match s.to_lowercase().as_str() {\n            \"perfmap\" => Ok(Self::Perfmap),\n            \"gdb\" => Ok(Self::Gdb),\n            \"lldb\" => Ok(Self::Lldb),\n            _ => Err(anyhow::anyhow!(\"Unrecognized profiler: {s}\")),\n        }\n    }\n}\n\nimpl RuntimeOptions {\n    fn validate_profiler(&self) -> Result<()> {\n        if self.experimental_artifact && !cfg!(target_os = \"linux\") {\n            bail!(\"--experimental-artifact is only supported on Linux\");\n        }\n        if !self.experimental_artifact {\n            match self.profiler {\n                Some(Profiler::Gdb) => {\n                    bail!(\"The gdb profiler requires --experimental-artifact\")\n                }\n                Some(Profiler::Lldb) => {\n                    bail!(\"The lldb profiler requires --experimental-artifact\")\n                }\n                _ => {}\n            }\n        }\n        Ok(())\n    }\n\n    pub fn get_available_backends(&self) -> Result<Vec<BackendType>> {\n        // If a specific backend is explicitly requested, use it\n        #[cfg(feature = \"cranelift\")]\n        {\n            if self.cranelift {\n                return Ok(vec![BackendType::Cranelift]);\n            }\n        }","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/cli/src/backend.rs#L209-L245","documentation":"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.","triggerScenarios":"Passing Profiler::Gdb (or --profile gdb) without also setting experimental_artifact / --experimental-artifact, when get_sys_compiler_config or get_engine builds the engine.","commonSituations":"Running `wasmer run --profile gdb` without the flag; scripts updated for gdb profiling but missing the experimental flag; docs showing only the profiler flag.","solutions":["Add --experimental-artifact alongside --profile gdb","Set RuntimeOptions.experimental_artifact = true when selecting Profiler::Gdb","Remove the gdb profiler option if profiling is not intended"],"exampleFix":"// before\nlet opts = RuntimeOptions { profiler: Some(Profiler::Gdb), experimental_artifact: false, .. };\n// after\nlet opts = RuntimeOptions { profiler: Some(Profiler::Gdb), experimental_artifact: true, .. };","handlingStrategy":"validation","validationCode":"if matches!(opts.profiler, Some(Profiler::Gdb)) && !opts.experimental_artifact {\n    eprintln!(\"gdb profiler needs --experimental-artifact; enabling\");\n    opts.experimental_artifact = true;\n}","typeGuard":"fn profiler_config_valid(opts: &RuntimeOptions) -> bool {\n    !matches!(opts.profiler, Some(Profiler::Gdb | Profiler::Lldb)) || opts.experimental_artifact\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"requires --experimental-artifact\") => retry_with_artifact_flag(),\n    other => other?,\n}","preventionTips":["Always pair --profile gdb with --experimental-artifact","Centralize profiler flag construction in one helper that adds the required flag","Validate the combined CLI flags in scripts before invoking wasmer"],"tags":["cli","profiler","gdb","flags","config"],"backgroundTag":"profiler-requires-flag","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}