wasmerio/wasmer · error

Unable to determine the package's entrypoint. Please choose

Error message

Unable to determine the package's entrypoint. Please choose one of {commands:?}

What it means

BinaryPackage::infer_entrypoint throws this when the package defines two or more commands and no explicit entrypoint is configured, so the library cannot decide which command to execute. The error message lists all candidate command names so the caller can pick one. It is raised from execute_webc during entrypoint resolution.

Source

Thrown at lib/wasix/src/bin_factory/binary_package.rs:339

                cmd.hash
            } else {
                ModuleHash::new(self.id.to_string())
            }
        })
    }

    pub fn infer_entrypoint(&self) -> Result<&str, anyhow::Error> {
        if let Some(entrypoint) = self.entrypoint_cmd.as_deref() {
            return Ok(entrypoint);
        }

        match self.commands.as_slice() {
            [] => anyhow::bail!("The package doesn't contain any executable commands"),
            [one] => Ok(one.name()),
            [..] => {
                let mut commands: Vec<_> = self.commands.iter().map(|cmd| cmd.name()).collect();
                commands.sort();
                anyhow::bail!(
                    "Unable to determine the package's entrypoint. Please choose one of {commands:?}"
                );
            }
        }
    }
}

#[cfg(test)]
mod tests {
    use sha2::Digest;
    use tempfile::TempDir;
    use virtual_fs::AsyncReadExt;
    use wasmer_package::utils::from_disk;

    use crate::{
        PluggableRuntime,
        runtime::{package_loader::BuiltinPackageLoader, task_manager::VirtualTaskManager},
    };

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Pass the desired command explicitly, e.g. `wasmer run pkg.webc --entry <command-name>` (or set entrypoint_cmd in the runner config).
  2. Pick a command name from the list shown in the error message.
  3. If one command should always be the default, rebuild the package marking it as the default entrypoint.

Example fix

// before
let pkg = BinaryPackage::from_webc(&webc)?;
execute_webc(env, pkg)  // panics/bails: which command?

// after
let mut pkg = BinaryPackage::from_webc(&webc)?;
pkg.entrypoint_cmd = Some("app".to_string());
execute_webc(env, pkg)
Defensive patterns

Strategy: validation

Validate before calling

// Rust: resolve the command name before running
let cmds: Vec<_> = pkg.commands.iter().map(|c| c.name().to_string()).collect();
if cmds.len() > 1 && pkg.entrypoint_cmd.is_none() {
    let chosen = std::env::var("APP_CMD")
        .ok()
        .filter(|c| cmds.contains(c))
        .expect("package has multiple commands; set APP_CMD or --entry");
    pkg.entrypoint_cmd = Some(chosen);
}

Type guard

fn has_single_or_explicit_entrypoint(pkg: &BinaryPackage) -> bool {
    pkg.entrypoint_cmd.is_some() || pkg.commands.len() == 1
}

Prevention

When it happens

Trigger: Executing a multi-command webc package (commands.len() > 1) without setting entrypoint_cmd or passing an explicit command name to the runner.

Common situations: Running `wasmer run package.webc` where the package exports several CLIs (e.g. a package containing both `server` and `cli`) without `wasmer run pkg --command cli`; older manifests where a default entrypoint was not recorded.

Related errors


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