rtk-ai/rtk · error
bunx requires a command argument
Error message
bunx requires a command argument
What it means
run_bunx_tool routes `rtk bunx <tool>` (and `bun x <tool>`) to the matching tool filter (tsc, eslint) or to the generic bunx runner. Bunx needs at least one argument — the package/tool to execute — so calling it with no arguments is invalid and the router bails immediately before executing anything.
Solutions
- Pass the tool/package you want to run: e.g. `rtk bunx tsc --noEmit` or `rtk bunx eslint .`.
- For usage help, run `rtk bunx --help` or `rtk --help` instead of a bare `rtk bunx`.
- If a script or alias triggers it, ensure it forwards arguments (`rtk bunx "$@"`) and is only called with a tool name.
Example fix
// before $ rtk bunx Error: bunx requires a command argument // after $ rtk bunx tsc --noEmit
Defensive patterns
Strategy: validation
Validate before calling
import sys, subprocess
args = sys.argv[1:] # args intended for `rtk bunx ...`
if not args:
raise SystemExit("usage: rtk bunx <tool> [args...] — e.g. rtk bunx tsc --noEmit")
subprocess.run(["rtk", "bunx", *args], check=False) Try / catch
import subprocess, sys
args = sys.argv[1:]
if not args:
sys.exit("bunx needs a tool argument")
r = subprocess.run(["rtk", "bunx", *args], capture_output=True, text=True)
if r.returncode != 0 and "requires a command argument" in r.stderr:
sys.exit("forward at least one tool name to bunx") Prevention
- Always invoke bunx with the tool name first: `rtk bunx <tool> [args...]`.
- In wrapper scripts, forward quoted "$@" and bail early when it is empty.
- Use `rtk bunx --help` (or `rtk --help`) for usage instead of running the bare command.
- Avoid aliases that consume the tool name before it reaches rtk.
When it happens
Trigger: Running `rtk bunx` with zero arguments, or `rtk bun x` where the arg-splitting yields an empty args slice for run_bunx_tool.
Common situations: Typing `rtk bunx` alone to check availability (expecting a help/banner like npx prints); a wrapper script forwarding "$@" when no args were given; accidentally invoking `bun x` without the package name; an alias swallowing the tool name.
Understand the failure class
Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.
Related errors
- ambiguous hash prefix
- Antigravity is project-scoped. Use: rtk init --agent…
- at least one of install_claude or install_opencode must be…
- --codex cannot be combined with --auto-patch
- --codex cannot be combined with --claude-md
AI-assisted analysis of rtk-ai/rtk@0924356b4c (2026-09-19).
Data as JSON: /api/errors/9019f25bf098837e.
Report an issue: GitHub.
Appendix: source
Thrown at src/main.rs:1520
Compile {
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<String>,
},
/// Install dependencies
Install {
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
args: Vec<String>,
},
/// Passthrough
#[command(external_subcommand)]
Other(Vec<OsString>),
}
/// Route `bunx <tool>` and `bun x <tool>` to the matching tool filter,
/// falling back to the generic bunx runner for unrecognized tools.
fn run_bunx_tool(args: &[String], verbose: u8, skip_env: bool) -> Result<i32> {
if args.is_empty() {
anyhow::bail!("bunx requires a command argument");
}
match args[0].as_str() {
"tsc" | "typescript" => tsc_cmd::run(Some("bunx"), &args[1..], verbose),
"eslint" => lint_cmd::run(Some("bunx"), args, verbose),
_ => bun_cmd::run_bunx(args, verbose, skip_env),
}
}
/// `awareness.level` for `rtk init`. A malformed config.toml falls back to `default` with a
/// warning instead of silently installing the wrong awareness file.
fn configured_awareness_level() -> core::config::AwarenessLevel {
match core::config::Config::load() {
Ok(config) => config.awareness.level,
Err(e) => {
let reason = e.to_string();
let first_line = reason.lines().next().unwrap_or("unreadable");
eprintln!(
"rtk: warning: could not read config.toml ({first_line}); using awareness.level = \"default\""View on GitHub (pinned to 0924356b4c)