wasmerio/wasmer · error
vm_exceptionref is only implemented for the sys backend
Error message
vm_exceptionref is only implemented for the sys backend
What it means
Exception::vm_exceptionref yields the raw VMExceptionRef for engine interop, dispatching only to the sys variant; other backends panic with unimplemented!().
Source
Thrown at lib/api/src/entities/exception/inner.rs:76
}
/// Gets the exception payload values.
#[inline]
pub fn payload(&self, store: &mut impl AsStoreMut) -> Vec<Value> {
match self {
#[cfg(feature = "sys")]
Self::Sys(s) => s.payload(store),
_ => unimplemented!("payload is only implemented for the sys backend"),
}
}
/// Get the `VMExceptionRef` corresponding to this `Exception`.
#[inline]
pub fn vm_exceptionref(&self) -> VMExceptionRef {
match self {
#[cfg(feature = "sys")]
Self::Sys(s) => VMExceptionRef::Sys(s.exnref()),
_ => unimplemented!("vm_exceptionref is only implemented for the sys backend"),
}
}
/// Creates a new `Exception` from a `VMExceptionRef`.
#[inline]
pub fn from_vm_exceptionref(exnref: VMExceptionRef) -> Self {
match exnref {
#[cfg(feature = "sys")]
VMExceptionRef::Sys(s) => {
Self::Sys(crate::backend::sys::exception::Exception::from_exnref(s))
}
_ => unimplemented!("from_vm_exceptionref is only implemented for the sys backend"),
}
}
}
View on GitHub (pinned to 8c4b9ee9d3)
Solutions
- Use the sys backend wherever vm_exceptionref is required
- Remove raw VMExceptionRef paths from backend-agnostic code
- Feature-gate the interop code to the sys backend
- Implement vm_exceptionref for the remaining backends
Defensive patterns
Strategy: validation
Validate before calling
if !exceptions_supported(&store) { return Err(...); } // backend must be Sys Type guard
fn is_sys_exception(ex: &ExceptionInner) -> bool {
matches!(ex, ExceptionInner::Sys(_))
}
Try / catch
let exn_ref = std::panic::catch_unwind(|| exn.vm_exceptionref()).ok();
Prevention
- Isolate raw VMExceptionRef usage in sys-gated modules
- Do not propagate exceptions across engines without backend checks
- Keep engine-interop layers per-backend instead of sharing them
When it happens
Trigger: Calling Exception::vm_exceptionref() when converting exceptions into VM-level representations (e.g. rethrowing, cross-boundary propagation) on a non-sys backend.
Common situations: Embedding layers that trap/rethrow wasm exceptions internally; engine interop glue written against the sys backend.
Related errors
- new is only implemented for the sys backend
- is_from_store is only implemented for the sys backend
- tag is only implemented for the sys backend
- payload is only implemented for the sys backend
- ExternRef is not yet supported in wasm_c_api
AI-assisted analysis of wasmerio/wasmer@8c4b9ee9d3 (2026-09-01).
Data as JSON: /api/errors/baa33c6dc2910a3f.
Report an issue: GitHub.