wasmerio/wasmer · error

only numeric types are supported in function signatures

Error message

only numeric types are supported in function signatures

What it means

When translating a Wasm module's type section, each value type is converted from the wasm-parser type to the compiler Type via wptype_to_type. This translator only supports numeric types (i32/i64/f32/f64 and refs per version); if a parameter type in a function signature cannot be represented (e.g. an unsupported SIMD or reference type), the translator panics instead of returning an error.

Source

Thrown at lib/compiler/src/translator/sections.rs:93

/// Parses the Type section of the wasm module.
pub fn parse_type_section(
    types: TypeSectionReader,
    module_translation_state: &mut ModuleTranslationState,
    environ: &mut ModuleEnvironment,
) -> WasmResult<()> {
    let count = types.count();
    environ.reserve_signatures(count)?;

    for res in types.into_iter_err_on_gc_types() {
        let functype = res.map_err(from_binaryreadererror_wasmerror)?;

        let params = functype.params();
        let returns = functype.results();
        let sig_params: Box<[Type]> = params
            .iter()
            .map(|ty| {
                wptype_to_type(*ty)
                    .expect("only numeric types are supported in function signatures")
            })
            .collect();
        let sig_returns: Box<[Type]> = returns
            .iter()
            .map(|ty| {
                wptype_to_type(*ty)
                    .expect("only numeric types are supported in function signatures")
            })
            .collect();
        let sig = FunctionType::new(sig_params, sig_returns);
        environ.declare_signature(sig)?;
        module_translation_state
            .wasm_types
            .push((params.to_vec().into(), returns.to_vec().into()));
    }

    Ok(())
}

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Rebuild wasmer with simd and reference-types features enabled
  2. Upgrade wasmer to a version supporting the value types used by the module
  3. Recompile the Wasm module to avoid unsupported types (e.g. no SIMD: build with `-m no-simd` toolchain flags)
  4. Validate the module with wasm-tools/wasmparser to see which types are unsupported

Example fix

// build with features
// before
wasmer = { version = "...", default-features = true }
// after
wasmer = { version = "...", features = ["simd", "reference-types"] }
Defensive patterns

Strategy: validation

Validate before calling

// Validate module types before compiling
use wasmparser::{Validator, WasmFeatures};
Validator::new_with_features(WasmFeatures::default() | WasmFeatures::SIMD)
    .validate_all(&wasm_bytes)
    .map_err(|e| anyhow!("module uses unsupported types: {e}"))?;

Type guard

fn has_unsupported_types(bytes: &[u8]) -> bool {
    wasmparser::Validator::new().validate_all(bytes).is_err()
}

Try / catch

std::panic::catch_unwind(|| compile_module(&engine, &wasm_bytes))
    .map_err(|_| anyhow::anyhow!("module uses value types unsupported by this compiler build"))?

Prevention

When it happens

Trigger: Translating (compiling) a module whose type section declares function params with a type wptype_to_type cannot map — e.g. v128 SIMD types or newer reference types when the compiler feature doesn't enable them.

Common situations: Compiling Wasm modules that use SIMD or reference types with a wasmer build compiled without simd/reference-types features; older wasmer versions encountering modern modules.

Related errors


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