rtk-ai/rtk · error
npx requires a command argument
Error message
npx requires a command argument
What it means
rtk npx is a filtering proxy around npx; with zero args there is no command to route — the dispatcher indexes args[0] to select the tsc/eslint/prisma/... filter. main validates this up front with a usage message instead of panicking on args[0].
Source
Thrown at src/main.rs:2315
write_rules,
min_confidence,
min_occurrences,
} => {
learn::run(
project,
all,
since,
format,
write_rules,
min_confidence,
min_occurrences,
)?;
0
}
Commands::Npx { args } => {
if args.is_empty() {
anyhow::bail!("npx requires a command argument");
}
// Intelligent routing: delegate to specialized filters
match args[0].as_str() {
"tsc" | "typescript" => tsc_cmd::run(&args[1..], cli.verbose)?,
"eslint" => lint_cmd::run(&args[1..], cli.verbose)?,
"prisma" => {
// Route to prisma_cmd based on subcommand
if args.len() > 1 {
let prisma_args: Vec<String> = args[2..].to_vec();
match args[1].as_str() {
"generate" => prisma_cmd::run(
prisma_cmd::PrismaCommand::Generate,
&prisma_args,
cli.verbose,
)?,
"db" if args.len() > 2 && args[2] == "push" => prisma_cmd::run(
prisma_cmd::PrismaCommand::DbPush,View on GitHub (pinned to d977e1c316)
Solutions
- Pass the command: `rtk npx tsc --noEmit`
- Guard wrappers: `[ $# -ge 1 ] || { echo 'usage: rtk npx <cmd> [args...]'; exit 2; }`
- Enable `set -u` in scripts so unset variables fail before rtk is invoked
Example fix
# before rtk npx "$MAYBE_EMPTY" # after rtk npx tsc --noEmit
Defensive patterns
Strategy: validation
Validate before calling
# bash: guard before proxying to rtk npx
[ $# -ge 1 ] && [ -n "$1" ] || { echo 'usage: rtk npx <cmd> [args...]' >&2; exit 2; }
rtk npx "$@" Prevention
- Use `set -u` in shell scripts so unset variables fail before reaching rtk
- Default optional tool variables explicitly: `TOOL=${TOOL:-tsc}`
When it happens
Trigger: `rtk npx` with no arguments — typically a wrapper interpolating an unset variable: `rtk npx $TOOL` with TOOL empty (src/main.rs:2317).
Common situations: Shell wrappers passing through optional arguments; docs placeholders never replaced; `set -u` not enabled so empty vars slip through.
Related errors
- proxy requires a command to execute Usage: rtk proxy <comman
- dotnet: no subcommand specified
- gt: no subcommand specified
- go: no subcommand specified
- sbt: no subcommand specified
AI-assisted analysis of rtk-ai/rtk@d977e1c316 (2026-08-16).
Data as JSON: /api/errors/c61543dd919a2e7e.
Report an issue: GitHub.