rtk-ai/rtk · error

proxy requires a command to execute Usage: rtk proxy

Error message

proxy requires a command to execute
Usage: rtk proxy <command> [args...]

What it means

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.

Solutions

  1. Pass the command and its arguments after `proxy`, e.g. `rtk proxy git log --oneline -20`.
  2. If the command comes from a variable, check it is non-empty before invoking rtk, or fall back to a default command.
  3. Use `rtk --help` or see the Proxy Mode docs in CLAUDE.md to confirm the expected `rtk proxy <command> [args...]` syntax.

Example fix

// before (shell)
rtk proxy

// after (shell)
rtk proxy git status
// or guard in a script:
[ -n "$CMD" ] && rtk proxy $CMD || echo "CMD is empty"
Defensive patterns

Strategy: validation

Validate before calling

if [ -z "$CMD" ]; then echo "rtk proxy needs a command" >&2; exit 1; fi
rtk proxy $CMD

Prevention

When it happens

Trigger: 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.

Common situations: 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.

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


AI-assisted analysis of rtk-ai/rtk@0924356b4c (2026-09-19). Data as JSON: /api/errors/123d70dc83531c3b. Report an issue: GitHub.

Appendix: source

Thrown at src/main.rs:3016

            list,
        } => core::retriever::run_recall(core::retriever::RecallArgs {
            hash: hash.as_deref(),
            full,
            from,
            lines,
            grep: grep.as_deref(),
            list,
        })?,

        Commands::Proxy { args } => {
            use crate::core::utils::ChildArgExt;
            use std::io::{Read, Write};
            use std::process::Stdio;
            use std::sync::atomic::{AtomicU32, Ordering};
            use std::thread;

            if args.is_empty() {
                anyhow::bail!(
                    "proxy requires a command to execute\nUsage: rtk proxy <command> [args...]"
                );
            }

            let timer = core::tracking::TimedExecution::start();

            // If a single quoted arg contains spaces, split it respecting quotes (#388).
            // e.g. rtk proxy 'head -50 file.php' → cmd=head, args=["-50", "file.php"]
            // e.g. rtk proxy 'git log --format="%H %s"' → cmd=git, args=["log", "--format=%H %s"]
            let (cmd_name, cmd_args): (String, Vec<String>) = if args.len() == 1 {
                let full = args[0].to_string_lossy();
                let parts = shell_split(&full);
                if parts.len() > 1 {
                    (parts[0].clone(), parts[1..].to_vec())
                } else {
                    (full.into_owned(), vec![])
                }
            } else {

View on GitHub (pinned to 0924356b4c)