{"record":{"id":"9019f25bf098837e","repo":"rtk-ai/rtk","slug":"bunx-requires-a-command-argument","errorCode":null,"errorMessage":"bunx requires a command argument","messagePattern":"bunx requires a command argument","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main.rs","lineNumber":1520,"sourceCode":"    Compile {\n        #[arg(trailing_var_arg = true, allow_hyphen_values = true)]\n        args: Vec<String>,\n    },\n    /// Install dependencies\n    Install {\n        #[arg(trailing_var_arg = true, allow_hyphen_values = true)]\n        args: Vec<String>,\n    },\n    /// Passthrough\n    #[command(external_subcommand)]\n    Other(Vec<OsString>),\n}\n\n/// Route `bunx <tool>` and `bun x <tool>` to the matching tool filter,\n/// falling back to the generic bunx runner for unrecognized tools.\nfn run_bunx_tool(args: &[String], verbose: u8, skip_env: bool) -> Result<i32> {\n    if args.is_empty() {\n        anyhow::bail!(\"bunx requires a command argument\");\n    }\n    match args[0].as_str() {\n        \"tsc\" | \"typescript\" => tsc_cmd::run(Some(\"bunx\"), &args[1..], verbose),\n        \"eslint\" => lint_cmd::run(Some(\"bunx\"), args, verbose),\n        _ => bun_cmd::run_bunx(args, verbose, skip_env),\n    }\n}\n\n/// `awareness.level` for `rtk init`. A malformed config.toml falls back to `default` with a\n/// warning instead of silently installing the wrong awareness file.\nfn configured_awareness_level() -> core::config::AwarenessLevel {\n    match core::config::Config::load() {\n        Ok(config) => config.awareness.level,\n        Err(e) => {\n            let reason = e.to_string();\n            let first_line = reason.lines().next().unwrap_or(\"unreadable\");\n            eprintln!(\n                \"rtk: warning: could not read config.toml ({first_line}); using awareness.level = \\\"default\\\"\"","sourceCodeStart":1502,"sourceCodeEnd":1538,"githubUrl":"https://github.com/rtk-ai/rtk/blob/0924356b4caba4989607227b7c8824d3d8098719/src/main.rs#L1502-L1538","documentation":"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.","triggerScenarios":"Running `rtk bunx` with zero arguments, or `rtk bun x` where the arg-splitting yields an empty args slice for run_bunx_tool.","commonSituations":"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.","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."],"exampleFix":"// before\n$ rtk bunx\nError: bunx requires a command argument\n\n// after\n$ rtk bunx tsc --noEmit","handlingStrategy":"validation","validationCode":"import sys, subprocess\n\nargs = sys.argv[1:]  # args intended for `rtk bunx ...`\nif not args:\n    raise SystemExit(\"usage: rtk bunx <tool> [args...] — e.g. rtk bunx tsc --noEmit\")\nsubprocess.run([\"rtk\", \"bunx\", *args], check=False)","typeGuard":null,"tryCatchPattern":"import subprocess, sys\nargs = sys.argv[1:]\nif not args:\n    sys.exit(\"bunx needs a tool argument\")\nr = subprocess.run([\"rtk\", \"bunx\", *args], capture_output=True, text=True)\nif r.returncode != 0 and \"requires a command argument\" in r.stderr:\n    sys.exit(\"forward at least one tool name to bunx\")","preventionTips":["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."],"tags":["cli","bun","arguments"],"backgroundTag":"missing-cli-argument","analyzedSha":"0924356b4caba4989607227b7c8824d3d8098719","analyzedAt":"2026-09-19T19:25:29.612Z","contentChangedAt":"2026-09-19T19:25:29.612Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}