{"record":{"id":"db7aaff39c407c14","repo":"wasmerio/wasmer","slug":"exception-handling-is-not-yet-supported-in-js","errorCode":null,"errorMessage":"Exception handling is not yet supported in js","messagePattern":"Exception handling is not yet supported in js","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/api/src/backend/js/entities/exception.rs","lineNumber":23,"sourceCode":"    AsStoreMut, AsStoreRef, Tag, Value,\n    js::vm::{VMException, VMExceptionRef},\n};\nuse std::any::Any;\nuse wasmer_types::{TagType, Type};\n\n#[derive(Debug, Clone, PartialEq, Eq)]\n/// A WebAssembly `tag` in the `v8` runtime.\npub(crate) struct Exception {\n    pub(crate) handle: VMException,\n}\n\nunsafe impl Send for Exception {}\nunsafe impl Sync for Exception {}\n\nimpl Exception {\n    /// Create a new [`Exception`].\n    pub fn new(store: &mut impl AsStoreMut, tag: Tag, payload: &[Value]) -> Self {\n        unimplemented!(\"Exception handling is not yet supported in js\");\n    }\n}\n","sourceCodeStart":5,"sourceCodeEnd":26,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/api/src/backend/js/entities/exception.rs#L5-L26","documentation":"The JavaScript backend's Exception entity (wasm exception handling) is a stub: Exception::new is declared but calls `unimplemented!(\"Exception handling is not yet supported in js\")`, so any attempt to create a JS-backend exception panics. The JS/Wasm heap backend never implemented the exception tag/payload machinery.","triggerScenarios":"Running wasmer with the js backend (wasm32-unknown/emscripten target under wasm) and executing a wasm module that uses wasm exception handling (throw / exception.new via a Tag) — the store tries to construct backend::Exception and hits the unimplemented constructor.","commonSituations":"Deploying wasmer compiled to JavaScript/Web in browsers or Node; modules using the exception-handling proposal or Emscripten EH (setjmp/longjmp via wasm EH); feature-parity gaps between native (sys) and js backends.","solutions":["Use wasm modules compiled without exception handling (disable wasm EH in the toolchain, e.g. -fwasm-exceptions off / legacynot-eh) when targeting the js backend","Run such workloads on the native (sys) backend where EH is implemented","Upgrade wasmer and check whether js-backend exception support landed","Guard embedder code: detect EH-using modules up front and reject them on the js backend with a clear error instead of a panic"],"exampleFix":"// embedder-side guard before instantiating\nif module_exports_or_features_use_eh(&module) && backend_is_js() {\n    return Err(\"exception handling unsupported on js backend\");\n}","handlingStrategy":"validation","validationCode":"// before instantiating on the js backend\nif uses_wasm_exceptions(&module_bytes) {\n    return Err(\"module uses wasm exception handling; unsupported on js backend\");\n}\nfunction uses_wasm_exceptions(bytes) { return new WebAssembly.Module(bytes) && importsUseTags(bytes); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Compile modules with wasm exception handling disabled for js targets","Route EH-using modules to the native sys backend","Check module imports for tag imports before instantiation","Keep wasmer-js updated for EH feature status"],"tags":["javascript","wasm","exceptions","unimplemented"],"backgroundTag":"js-backend-unsupported-feature","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}