denoland/deno · error · anyhow::Error
Unable to choose binary for {} Available bins: {}
Error message
Unable to choose binary for {}
Available bins:
{} What it means
For an npm package run via `deno x`, deno selects the `bin` entry matching the invoked command name (or the fallback name). When the package exposes multiple bins and none matches, it lists every available bin and errors instead of guessing.
Source
Thrown at cli/tools/x.rs:749
None
};
if let Some(fallback_name) = fallback_name
&& let Some(exit_code) = maybe_run_local_npm_bin(
&runner_factory,
&runner_flags,
runner_node_resolver,
runner_npm_resolver,
fallback_name.as_ref(),
&unstable_args,
&forwarded,
)
.await?
{
return Ok(exit_code);
}
Err(anyhow::anyhow!(
"Unable to choose binary for {}\n Available bins:\n{}",
effective_command,
bin_commands
.keys()
.map(|k| format!(" {}", k))
.collect::<Vec<_>>()
.join("\n")
))
}
}
ReqRefOrUrl::Jsr(jsr_package_req_reference) => {
let (_new_flags, new_factory) = autoinstall_package(
ReqRef::Jsr(&jsr_package_req_reference),
&flags,
reload,
command_flags.yes,
&command_flags.ignore_scripts,
&factory.deno_dir()?.root,View on GitHub (pinned to 89f33cbef2)
Solutions
- Re-run with the explicit binary from the list: `deno x some-pkg/<bin-name>`
- Copy the spelling exactly from the 'Available bins:' section — entries are case-sensitive
- If you maintain the package, make sure package.json's bin map includes the command name users invoke
Example fix
# before deno x some-pkg # after (pick a listed bin) deno x some-pkg/some-pkg-cli
Defensive patterns
Strategy: validation
Validate before calling
# bash: query the package's bin entries first and pass one explicitly
bins=$(npm exec --package=some-pkg -- node -p "Object.keys(require('./package.json').bin).join(' ')" 2>/dev/null)
echo "available bins: $bins"
deno x "some-pkg/$(echo $bins | awk '{print $1}')" Prevention
- Invoke multi-bin packages as `<pkg>/<bin>` rather than by package name alone
- Read the package's bin map when adding it to scripts
- Treat the 'Available bins:' list in the error as the source of truth for spelling
When it happens
Trigger: `deno x some-pkg` where some-pkg's package.json `bin` map has several entries and none matches the invoked name or the fallback.
Common situations: CLI packages that ship several executables; running the package by its name when the intended bin has a different name; case mismatches in bin names.
Related errors
- Cannot use --watch with an npm package whose bin entry is a
- Use 'deno run' to run a local file directly, 'deno x' is int
- Installation rejected
- The bench name can't be empty
- invalid doc test hashbang: #!/bin/sh (binary basename needs
AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16).
Data as JSON: /api/errors/6203c3cbb5a641fc.
Report an issue: GitHub.