{"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":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main.rs","lineNumber":1450,"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\nfn run_fallback(parse_error: clap::Error) -> Result<i32> {\n    let args: Vec<String> = std::env::args().skip(1).collect();\n\n    // No args → show Clap's error (user ran just \"rtk\" with bad syntax)\n    if args.is_empty() {\n        parse_error.exit();\n    }\n\n    // RTK meta-commands should never fall back to raw execution.\n    // e.g. `rtk gain --badtypo` should show Clap's error, not try to run `gain` from $PATH.","sourceCodeStart":1432,"sourceCodeEnd":1468,"githubUrl":"https://github.com/rtk-ai/rtk/blob/36788f6bd4932037caac5cbb1d15d6e2fb9f33da/src/main.rs#L1432-L1468","documentation":"rtk's `bunx` proxy command routes the given tool to a specialized filter (tsc, eslint) or a generic bunx runner. This error is thrown when `bunx` is invoked with no arguments at all, since there is nothing to execute. It is an input-validation guard in `run_bunx_tool` (src/main.rs:1450).","triggerScenarios":"Running `rtk bunx` (or `rtk bun x`) with an empty `args` slice — i.e. no tool/command specified after bunx.","commonSituations":"Shell variable holding the tool name is empty; a script builds the bunx invocation dynamically and drops the command; a user forgets the package name; an alias wraps `rtk bunx` and arguments get lost.","solutions":["Pass the tool to execute: `rtk bunx tsc --noEmit`","Check that any shell variable interpolating the command (e.g. `$TOOL`) is non-empty","If using `rtk bun x`, ensure the tool name follows the `x` subcommand"],"exampleFix":"// before\nrtk bunx\n// after\nrtk bunx prettier --write .","handlingStrategy":"validation","validationCode":"if [ -z \"$1\" ]; then echo \"usage: rtk bunx <tool> [args...]\" >&2; exit 2; fi\nrtk bunx \"$@\"","typeGuard":null,"tryCatchPattern":"rtk bunx \"$@\" || { echo \"bunx invocation failed (check a tool argument was passed)\" >&2; exit $?; }","preventionTips":["Always list the tool immediately after `rtk bunx`","Guard interpolated variables with `${TOOL:?tool not set}` in scripts","Test wrapper aliases with an empty-arg invocation"],"tags":["cli","argument-validation","bunx"],"backgroundTag":"missing-required-cli-argument","analyzedSha":"36788f6bd4932037caac5cbb1d15d6e2fb9f33da","analyzedAt":"2026-09-03T16:33:57.738Z","contentChangedAt":"2026-09-03T16:33:57.738Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}