{"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":2521,"sourceCode":"                let shell = if cfg!(windows) { \"cmd\" } else { \"sh\" };\n                let flag = if cfg!(windows) { \"/C\" } else { \"-c\" };\n                let status = ProcCommand::new(shell)\n                    .arg(flag)\n                    .arg(&raw)\n                    .status()\n                    .with_context(|| format!(\"Failed to execute: {}\", raw))?;\n                core::utils::exit_code_from_status(&status, \"run\")\n            }\n        }\n\n        Commands::Proxy { args } => {\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":2503,"sourceCodeEnd":2539,"githubUrl":"https://github.com/rtk-ai/rtk/blob/d977e1c31621fe8704e6500ceeb9c7a0de2b6836/src/main.rs#L2503-L2539","documentation":"rtk proxy executes a command verbatim (no filtering) while tracking metrics, so it needs at least one command token; empty args bail with an embedded usage line. Note that a single quoted argument containing spaces is shell-split by rtk ('rtk proxy 'head -50 file.php'' becomes head -50 file.php), so a one-arg call is valid as long as the arg is non-empty.","triggerScenarios":"`rtk proxy` with no arguments, or a wrapper passing an empty string that shell_split reduces to nothing (src/main.rs:2525).","commonSituations":"Scripts assembling `rtk proxy $CMD` from optional variables; argument-dropping in nested quoting layers.","solutions":["Run `rtk proxy <command> [args...]`, e.g. `rtk proxy git log --oneline -20`","Quote a whole command as one arg only when you want rtk's built-in split: `rtk proxy 'git log --format=\"%H %s\"'`","Add an argument guard in wrappers before calling rtk"],"exampleFix":"# before\nrtk proxy                 # bails with usage\n\n# after\nrtk proxy git log --oneline -20","handlingStrategy":"validation","validationCode":"# bash: guard before proxying to rtk proxy\n[ $# -ge 1 ] && [ -n \"$1\" ] || { echo 'usage: rtk proxy <command> [args...]' >&2; exit 2; }\nrtk proxy \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check interpolated command variables are non-empty before building the rtk proxy invocation","Quote whole commands as a single arg only when you want rtk's shell-split behavior"],"tags":["cli","proxy","usage","arguments"],"backgroundTag":null,"analyzedSha":"d977e1c31621fe8704e6500ceeb9c7a0de2b6836","analyzedAt":"2026-08-16T05:40:46.291Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}