wasmerio/wasmer · error

Exception handling is not yet supported in v8

Error message

Exception handling is not yet supported in v8

What it means

The v8 backend does not implement WebAssembly exception handling. `Exception::new` is an unconditional stub, so any attempt to create an exception (host-side `raise`/throw through wasmer) panics with this message.

Source

Thrown at lib/api/src/backend/v8/entities/exception.rs:25

    AsStoreMut, AsStoreRef, Tag, Value,
    v8::vm::{VMException, VMExceptionRef},
};

use super::store::StoreHandle;

#[derive(Debug, Clone, PartialEq, Eq)]
/// A WebAssembly `tag` in the `v8` runtime.
pub(crate) struct Exception {
    pub(crate) handle: VMException,
}

unsafe impl Send for Exception {}
unsafe impl Sync for Exception {}

impl Exception {
    /// Create a new [`Exception`].
    pub fn new(store: &mut impl AsStoreMut, tag: Tag, payload: &[Value]) -> Self {
        unimplemented!("Exception handling is not yet supported in v8");
    }
}

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Use the sys backend (`wasmer = { features = ["sys"] }`) which supports exception handling
  2. Guard exception code behind a backend feature check and provide a non-exception fallback for v8 builds
  3. Model errors as return values (e.g. Result-typed exports) instead of wasm exceptions when targeting v8

Example fix

// before
let ex = Exception::new(&mut store, tag, &payload); // panics on v8
// after
#[cfg(feature = "sys")]
let ex = Exception::new(&mut store, tag, &payload);
#[cfg(feature = "v8")]
return Err(unsupported_on_v8());
Defensive patterns

Strategy: fallback

Validate before calling

fn exceptions_supported() -> bool {
    cfg!(feature = "sys") // v8 backend has no exception support
}

Type guard

fn exceptions_supported() -> bool {
    cfg!(feature = "sys")
}

Try / catch

if !exceptions_supported() {
    return Err(anyhow!("exception handling requires the sys backend"));
}
let ex = Exception::new(&mut store, tag, &payload);

Prevention

When it happens

Trigger: Calling `Exception::new(&mut store, tag, payload)` in code built with the v8 backend (`--features v8` / default native v8 features) — regardless of arguments.

Common situations: Cross-backend code implementing wasm exception-handling (`throw`/`try_table`) that runs on sys/js but is compiled for v8; enabling v8 features in an app that uses wasmer's exceptions API.

Related errors


AI-assisted analysis of wasmerio/wasmer@8c4b9ee9d3 (2026-09-01). Data as JSON: /api/errors/92c5c3ecef8b91ac. Report an issue: GitHub.