{"record":{"id":"ad7f372fa0a6af88","repo":"wasmerio/wasmer","slug":"not-a-sys-backend","errorCode":null,"errorMessage":"not a `sys` backend!","messagePattern":"not a `sys` backend!","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/c-api/src/wasm_c_api/engine/config/sys.rs","lineNumber":142,"sourceCode":"                        }\n                        _ => {\n                            update_last_error(\"Wasmer has not been compiled with the `llvm` feature.\");\n                            return None;\n                        }\n                    }\n                },\n                wasmer_backend_t::SINGLEPASS => {\n                    cfg_select! {\n                        feature = \"singlepass\" => {\n                            Box::<wasmer_compiler_singlepass::Singlepass>::default()\n                        }\n                        _ => {\n                            update_last_error(\"Wasmer has not been compiled with the `singlepass` feature.\");\n                            return None;\n                        }\n                    }\n                },\n                _ => panic!(\"not a `sys` backend!\")\n            };\n\n            #[cfg(feature = \"middlewares\")]\n            for middleware in config.backend_config.middlewares {\n                compiler_config.push_middleware(middleware.inner.clone());\n            }\n\n            if sys_config.nan_canonicalization {\n                compiler_config.canonicalize_nans(true);\n            }\n\n            let inner: Engine = {\n                let mut builder = EngineBuilder::new(compiler_config);\n\n                if let Some(target) = config.backend_config.target {\n                    builder = builder.set_target(Some(target.inner));\n                }\n","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/c-api/src/wasm_c_api/engine/config/sys.rs#L124-L160","documentation":"wasm_sys_engine_new_with_config converts a C API engine config into a sys (native Cranelift/LLVM/Singlepass) compiler configuration. It panics when the config's backend is not a `sys`-family backend (e.g. the caller passed a V8, WASMI, or Headless engine config to the sys engine constructor). This is a misuse check: only sys backends can be translated into a sys engine config.","triggerScenarios":"Calling wasm_sys_engine_new_with_config with a wasmer_engine_config_t whose backend was set to a non-sys kind (V8, headless, etc.), or with a compiler enum variant the current feature set doesn't map (the match falls through to the panic arm).","commonSituations":"Mixing C API engine constructors with configs built for another backend; building Wasmer without the expected compiler feature (e.g. singlepass) so the config variant reaches the catch-all arm; copy-pasted C code using one backend's engine with another's config.","solutions":["Ensure the config passed to wasm_sys_engine_new_with_config was created with a sys-family backend (Cranelift, LLVM, Singlepass).","Use the matching engine constructor: wasm_engine_new_with_config / backend-specific engine constructors for non-sys backends.","Rebuild Wasmer with the compiler features you configure (e.g. --features singlepass) so the backend variant is recognized before the catch-all.","Check compiler warnings/logs to confirm which backends your Wasmer build actually supports."],"exampleFix":"// before\nwasmer_backend_t *backend = wasmer_backend_new( /* V8 config */ );\nwasmer_engine_t *engine = wasm_sys_engine_new_with_config(v8_config); // panics\n// after\nwasmer_config_t *cfg = wasmer_config_new();\nwasmer_config_set_compiler(cfg, WASMER_COMPILER_CRANELIFT); // sys backend\nwasmer_engine_t *engine = wasm_sys_engine_new_with_config(cfg);","handlingStrategy":"validation","validationCode":"// C: verify the config's backend is sys-family before calling\nif (!wasmer_config_is_sys_backend(cfg)) {\n    fprintf(stderr, \"config is not a sys backend; use the matching engine ctor\\n\");\n    return NULL;\n}\nwasmer_engine_t *engine = wasm_sys_engine_new_with_config(cfg);","typeGuard":"// Rust-side guard when building configs\nfn is_sys_backend(b: BackendKind) -> bool {\n    matches!(b, BackendKind::Cranelift | BackendKind::LLVM | BackendKind::Singlepass)\n}","tryCatchPattern":null,"preventionTips":["Pair each engine constructor with configs built for the same backend.","Rebuild Wasmer with all compiler features you configure.","Log the configured backend before engine creation."],"tags":["rust","panic","c-api","engine","config-mismatch"],"backgroundTag":"backend-config-mismatch","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}