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

  1. Use the sys backend for exception-handling workflows
  2. Gate payload extraction behind a backend check
  3. Encode exception data in linear memory rather than wasm exception payloads
  4. 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

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


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