wasmerio/wasmer · error

tag is only implemented for the sys backend

Error message

tag is only implemented for the sys backend

What it means

Exception::tag returns the exception's tag, dispatching only to the sys backend variant; any other backend variant panics with unimplemented!().

Source

Thrown at lib/api/src/entities/exception/inner.rs:56

    }

    /// Checks whether this `Exception` can be used with the given store.
    #[inline]
    pub fn is_from_store(&self, store: &impl AsStoreRef) -> bool {
        match self {
            #[cfg(feature = "sys")]
            Self::Sys(s) => s.is_from_store(store),
            _ => unimplemented!("is_from_store is only implemented for the sys backend"),
        }
    }

    /// 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")]

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Restrict exception handling to the sys backend
  2. Check backend support before reading the tag; treat non-sys exceptions as unsupported
  3. Use a common error channel (memory + i32 codes) instead of wasm exceptions
  4. Implement tag() for the remaining backends
Defensive patterns

Strategy: type-guard

Validate before calling

if !matches!(exn.inner(), ExceptionInner::Sys(_)) { return Err(...); }

Type guard

fn sys_tag(ex: &Exception, store: &impl AsStoreRef) -> Option<Tag> {
    match ex {
        Exception::Sys(_) if backend_is_sys(store) => Some(ex.tag(store)),
        _ => None,
    }
}

Try / catch

let tag = std::panic::catch_unwind(|| exn.tag(&store)).ok();

Prevention

When it happens

Trigger: Calling Exception::tag(store) when the Exception holds a non-Sys backend variant, e.g. on the v8 backend with the exception-handling feature exposed.

Common situations: Exception handlers matching on tags to classify guest errors; cross-backend test harnesses.

Related errors


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