wasmerio/wasmer · error · anyhow::Error

The {} backend does not support the required features for th

Error message

The {} backend does not support the required features for the Wasm module{}

What it means

get_engine_for_features determines which compiled backends can satisfy the Wasm features the module requires. If some backends remain after filtering by required features but the first (selected) backend cannot support them, it bails telling you the current backend is insufficient and suggesting an alternative backend via the formatted hint suffix.

Source

Thrown at lib/cli/src/backend.rs:322

        required_features: &Features,
        target: &Target,
    ) -> Result<Engine> {
        let backends = self.get_available_backends()?;
        let filtered_backends =
            Self::filter_backends_by_features(backends.clone(), required_features, target);

        if filtered_backends.is_empty() {
            let enabled_backends = BackendType::enabled();
            if backends.len() == 1 && enabled_backends.len() > 1 {
                // If the user has chosen an specific backend, we can suggest to use another one
                let filtered_backends =
                    Self::filter_backends_by_features(enabled_backends, required_features, target);
                let extra_text: String = if !filtered_backends.is_empty() {
                    format!(". You can use --{} instead", filtered_backends[0])
                } else {
                    "".to_string()
                };
                bail!(
                    "The {} backend does not support the required features for the Wasm module{}",
                    backends[0],
                    extra_text
                );
            } else {
                bail!(
                    "No backends support the required features for the Wasm module. Feel free to open an issue at https://github.com/wasmerio/wasmer/issues"
                );
            }
        }
        filtered_backends.first().unwrap().get_engine(target, self)
    }

    #[cfg(feature = "compiler")]
    /// Get the enabled Wasm features.
    pub fn get_features(&self, default_features: &Features) -> Result<Features> {
        if self.features.all {
            return Ok(Features::all());

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Switch to the backend suggested in the error message (the `You can use --<backend> instead` hint), e.g. pass --llvm
  2. Enable the missing feature in the selected backend's compiler config if supported
  3. Compile/re-export the module without the unsupported features

Example fix

// before
wasmer run app.wasm            # defaults to cranelift, needs llvm features
// after
wasmer run app.wasm --llvm     # use the suggested backend
Defensive patterns

Strategy: fallback

Validate before calling

let required = module.features();
let supported = BackendType::all().filter(|b| b.supports_features(&required));
if !supported.contains(&selected_backend) {
    eprintln!("switch to {:?}", supported.first());
}

Try / catch

match result {
    Err(e) if e.to_string().contains("does not support the required features") => {
        let alt = extract_suggested_backend(&e.to_string());
        retry_with_backend(alt)
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling get_engine_for_module/get_engine_for_features with a module that uses features (e.g. threads, simd, reference types) unsupported by the configured backend while another installed backend does support them.

Common situations: Running a module needing LLVM-only features with the Singlepass/Cranelift backend selected; defaulting to a backend that lacks a newly used proposal; headless binary with restricted backend feature sets.

Related errors


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