{"record":{"id":"c197a536d6ba19dd","repo":"wasmerio/wasmer","slug":"new-is-only-implemented-for-the-sys-backend","errorCode":null,"errorMessage":"new is only implemented for the sys backend","messagePattern":"new is only implemented for the sys backend","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/api/src/entities/exception/inner.rs","lineNumber":36,"sourceCode":"}\n\nimpl BackendException {\n    /// Create a new exception with the given tag type and payload.\n    #[inline]\n    #[allow(irrefutable_let_patterns)]\n    pub fn new(store: &mut impl AsStoreMut, tag: &Tag, payload: &[Value]) -> Self {\n        match &store.as_store_mut().inner.store {\n            #[cfg(feature = \"sys\")]\n            crate::BackendStore::Sys(_) => {\n                let BackendTag::Sys(tag) = &tag.0 else {\n                    panic!(\"cannot create Exception with Tag from another backend\");\n                };\n\n                Self::Sys(crate::backend::sys::exception::Exception::new(\n                    store, tag, payload,\n                ))\n            }\n            _ => unimplemented!(\"new is only implemented for the sys backend\"),\n        }\n    }\n\n    /// Checks whether this `Exception` can be used with the given store.\n    #[inline]\n    pub fn is_from_store(&self, store: &impl AsStoreRef) -> bool {\n        match self {\n            #[cfg(feature = \"sys\")]\n            Self::Sys(s) => s.is_from_store(store),\n            _ => unimplemented!(\"is_from_store is only implemented for the sys backend\"),\n        }\n    }\n\n    /// Gets the exception tag.\n    #[inline]\n    pub fn tag(&self, store: &impl AsStoreRef) -> Tag {\n        match self {\n            #[cfg(feature = \"sys\")]","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/api/src/entities/exception/inner.rs#L18-L54","documentation":"Exception::new creates a WebAssembly exception (exception-handling proposal), but the enum wrapper only implements construction for the sys backend; any other configured backend hits the catch-all arm and panics with unimplemented!().","triggerScenarios":"Calling Exception::new(store, tag, payload) when the store's backend is anything other than sys (e.g. v8, wasmi, wasm_c_api) while the exception feature is enabled.","commonSituations":"Apps using the wasm exception-handling proposal that switch engines; test suites running the same code across multiple backend features.","solutions":["Enable/use only the sys backend when working with Wasm exceptions","Feature-gate exception usage: check the active backend before creating exceptions","Communicate errors via ordinary imports/returns instead of wasm exceptions on non-sys backends","Contribute Exception::new implementations for other backends"],"exampleFix":"// before\nlet exn = Exception::new(&mut store, &tag, payload);\n// after\nlet exn = match store.engine().backend() {\n    Backend::Sys => Exception::new(&mut store, &tag, payload),\n    _ => return Err(\"exceptions require the sys backend\".into()),\n};","handlingStrategy":"validation","validationCode":"fn exceptions_supported(store: &impl AsStoreRef) -> bool {\n    matches!(store.as_store_ref().engine().backend(), Backend::Sys)\n}\n","typeGuard":"fn is_sys_exception(ex: &ExceptionInner) -> bool {\n    matches!(ex, ExceptionInner::Sys(_))\n}\n","tryCatchPattern":"let exn = std::panic::catch_unwind(|| Exception::new(&mut store, &tag, payload));\nmatch exn {\n    Ok(e) => Ok(e),\n    Err(_) => Err(UnsupportedBackendError::Exceptions),\n}\n","preventionTips":["Enable exceptions only with the sys feature enabled","Assert the backend at startup when using the exception-handling proposal","Add cross-backend CI jobs to catch these early"],"tags":["wasm","exception-handling","unimplemented","backend-support"],"backgroundTag":"feature-only-sys-backend","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}