{"record":{"id":"123d70dc83531c3b","repo":"rtk-ai/rtk","slug":"proxy-requires-a-command-to-execute-usage-rtk-pro","errorCode":null,"errorMessage":"proxy requires a command to execute\nUsage: rtk proxy <command> [args...]","messagePattern":"proxy requires a command to execute\nUsage: rtk proxy <command> \\[args\\.\\.\\.\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main.rs","lineNumber":3016,"sourceCode":"            list,\n        } => core::retriever::run_recall(core::retriever::RecallArgs {\n            hash: hash.as_deref(),\n            full,\n            from,\n            lines,\n            grep: grep.as_deref(),\n            list,\n        })?,\n\n        Commands::Proxy { args } => {\n            use crate::core::utils::ChildArgExt;\n            use std::io::{Read, Write};\n            use std::process::Stdio;\n            use std::sync::atomic::{AtomicU32, Ordering};\n            use std::thread;\n\n            if args.is_empty() {\n                anyhow::bail!(\n                    \"proxy requires a command to execute\\nUsage: rtk proxy <command> [args...]\"\n                );\n            }\n\n            let timer = core::tracking::TimedExecution::start();\n\n            // If a single quoted arg contains spaces, split it respecting quotes (#388).\n            // e.g. rtk proxy 'head -50 file.php' → cmd=head, args=[\"-50\", \"file.php\"]\n            // e.g. rtk proxy 'git log --format=\"%H %s\"' → cmd=git, args=[\"log\", \"--format=%H %s\"]\n            let (cmd_name, cmd_args): (String, Vec<String>) = if args.len() == 1 {\n                let full = args[0].to_string_lossy();\n                let parts = shell_split(&full);\n                if parts.len() > 1 {\n                    (parts[0].clone(), parts[1..].to_vec())\n                } else {\n                    (full.into_owned(), vec![])\n                }\n            } else {","sourceCodeStart":2998,"sourceCodeEnd":3034,"githubUrl":"https://github.com/rtk-ai/rtk/blob/0924356b4caba4989607227b7c8824d3d8098719/src/main.rs#L2998-L3034","documentation":"rtk's proxy mode forwards a command to the OS and tracks its usage without filtering. Before spawning the child process, main.rs checks that at least one argument (the command to execute) was supplied after `proxy`; if `args.is_empty()` it aborts via `anyhow::bail!` with the usage string. This is a deliberate guard so `rtk proxy` alone fails fast with an actionable message instead of spawning a shell with no program.","triggerScenarios":"Running `rtk proxy` with no further arguments — the `Commands::Proxy { args }` variant is matched with an empty args vector, so the `args.is_empty()` bail at src/main.rs:3016 fires before any process spawn.","commonSituations":"Typing `rtk proxy` bare to check it works; scripts that build the proxy command from an empty variable (e.g. `rtk proxy $CMD` with CMD unset); wrappers that strip arguments before delegating to rtk.","solutions":["Pass the command and its arguments after `proxy`, e.g. `rtk proxy git log --oneline -20`.","If the command comes from a variable, check it is non-empty before invoking rtk, or fall back to a default command.","Use `rtk --help` or see the Proxy Mode docs in CLAUDE.md to confirm the expected `rtk proxy <command> [args...]` syntax."],"exampleFix":"// before (shell)\nrtk proxy\n\n// after (shell)\nrtk proxy git status\n// or guard in a script:\n[ -n \"$CMD\" ] && rtk proxy $CMD || echo \"CMD is empty\"","handlingStrategy":"validation","validationCode":"if [ -z \"$CMD\" ]; then echo \"rtk proxy needs a command\" >&2; exit 1; fi\nrtk proxy $CMD","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass at least one argument after `rtk proxy`.","In scripts, guard command variables for emptiness before building the rtk invocation.","Remember `rtk proxy` never supplies a default command by design."],"tags":["cli","proxy-mode","missing-argument","usage-error"],"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"}