wasmerio/wasmer · error
payload is only implemented for the sys backend
Error message
payload is only implemented for the sys backend
What it means
Exception::payload returns the exception's payload values, but only the sys backend variant is implemented; all other backends panic with unimplemented!().
Source
Thrown at lib/api/src/entities/exception/inner.rs:66
}
/// Gets the exception tag.
#[inline]
pub fn tag(&self, store: &impl AsStoreRef) -> Tag {
match self {
#[cfg(feature = "sys")]
Self::Sys(s) => Tag(BackendTag::Sys(s.tag(store))),
_ => unimplemented!("tag is only implemented for the sys backend"),
}
}
/// 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")]View on GitHub (pinned to 8c4b9ee9d3)
Solutions
- Use the sys backend for exception-handling workflows
- Gate payload extraction behind a backend check
- Encode exception data in linear memory rather than wasm exception payloads
- Implement payload() for other backends
Defensive patterns
Strategy: type-guard
Validate before calling
if !matches!(exn.inner(), ExceptionInner::Sys(_)) { return Err(...); } Type guard
fn sys_payload(ex: &Exception, store: &mut impl AsStoreMut) -> Option<Vec<Value>> {
if backend_is_sys(store) { Some(ex.payload(store)) } else { None }
}
Try / catch
let payload = std::panic::catch_unwind(|| exn.payload(&mut store)).unwrap_or_default();
Prevention
- Inspect payloads only in sys-backend handlers
- Avoid exception payloads as a data channel if you target multiple backends
- Test catch handlers against every configured backend
When it happens
Trigger: Calling Exception::payload(store) on a non-Sys Exception variant, typically in a catch handler inspecting exception data on a non-sys backend.
Common situations: Host catch handlers extracting guest exception arguments; code ported from sys-backend-only builds.
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
- vm_exceptionref 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/c826ba6db61a85ee.
Report an issue: GitHub.