wasmerio/wasmer · error · anyhow::Error

The package doesn't contain any bindings

Error message

The package doesn't contain any bindings

What it means

When resolving bindings for a package (used by `wasmer add` to generate typed bindings), lookup_bindings_for_package found no bindings at all in the package's wasmer.toml/manifest and bails. The library throws this because the command's purpose is to produce bindings and the package simply has none.

Source

Thrown at lib/cli/src/commands/add.rs:121

    language: &ProgrammingLanguage,
) -> Result<Bindings, Error> {
    let all_bindings = wasmer_backend_api::query::list_bindings(
        client,
        &pkg.name,
        pkg.version_opt().map(|v| v.to_string()).as_deref(),
    )
    .await?;

    match all_bindings.iter().find(|b| b.language == *language) {
        Some(b) => {
            let Bindings { url, generator, .. } = b;
            log::debug!("Found {pkg} bindings generated by {generator:?} at {url}");

            Ok(b.clone())
        }
        None => {
            if all_bindings.is_empty() {
                anyhow::bail!("The package doesn't contain any bindings");
            } else {
                todo!();
            }
        }
    }
}

#[derive(Debug, Copy, Clone)]
enum Target {
    Pip,
    Yarn { dev: bool },
    Npm { dev: bool },
    Pnpm { dev: bool },
}

impl Target {
    fn language(self) -> ProgrammingLanguage {
        match self {

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Verify the package's manifest (wasmer.toml) actually contains a [[bindings]] section with a valid generator (e.g. js, pyo3) and republish if you own it.
  2. Reference the correct package name/version that is known to ship bindings.
  3. If you only need the wasm module, consume it directly instead of via the bindings-adding command.

Example fix

// before: wasmer.toml without bindings -> 'The package doesn't contain any bindings'
// after: add to wasmer.toml
// [[bindings]]
// name = "mybindings"
// kind = "js"
// package = "my/package"
Defensive patterns

Strategy: validation

Validate before calling

// check the package manifest exposes bindings before running `wasmer add`
let manifest = wasmer_config::package::Package::parse(&toml_text)?;
if manifest.bindings.is_empty() {
    eprintln!("package has no [[bindings]]; skipping add");
}

Type guard

fn has_bindings(manifest: &PackageManifest) -> bool {
    !manifest.bindings.is_empty()
}

Try / catch

match lookup_bindings_for_package(...) {
    Ok(b) => b,
    Err(e) if e.to_string().contains("doesn't contain any bindings") => {
        eprintln!("no bindings in package; using raw wasm module instead");
        Default::default()
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Running `wasmer add <package>` where the target package's manifest declares no [bindings] sections, so all_bindings is empty.

Common situations: Adding a plain WASM package that was published without binding generator config; typos in the bindings kind; older packages published before bindings support.

Related errors


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