{"record":{"id":"6082dbe71ae94375","repo":"wasmerio/wasmer","slug":"experimental-artifact-is-only-supported-on-linux","errorCode":null,"errorMessage":"--experimental-artifact is only supported on Linux","messagePattern":"--experimental-artifact is only supported on Linux","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"lib/cli/src/backend.rs","lineNumber":222,"sourceCode":"}\n\nimpl FromStr for Profiler {\n    type Err = anyhow::Error;\n\n    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\")]","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/cli/src/backend.rs#L204-L240","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Only pass --experimental-artifact on Linux builds","Gate the flag on target OS in your launcher (cfg!(target_os = \"linux\") or runtime OS check)","Drop the flag if you do not need the profiler/artifact instrumentation"],"exampleFix":"// before\nlet opts = RuntimeOptions { experimental_artifact: true, .. };\n// after\nlet opts = RuntimeOptions { experimental_artifact: cfg!(target_os = \"linux\"), .. };","handlingStrategy":"validation","validationCode":"if opts.experimental_artifact && !cfg!(target_os = \"linux\") {\n    eprintln!(\"--experimental-artifact requires Linux; disabling\");\n    opts.experimental_artifact = false;\n}","typeGuard":"fn can_use_experimental_artifact(opts: &RuntimeOptions) -> bool {\n    !opts.experimental_artifact || cfg!(target_os = \"linux\")\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"only supported on Linux\") => run_without_artifact(),\n    other => other?,\n}","preventionTips":["Gate profiler/artifact flags behind an OS check in launch scripts","Keep per-platform CI invocations in separate config files","Never enable experimental_artifact by default in cross-platform tools"],"tags":["cli","platform","linux","profiler","flags"],"backgroundTag":"unsupported-platform-flag","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}