{"record":{"id":"c61543dd919a2e7e","repo":"rtk-ai/rtk","slug":"npx-requires-a-command-argument","errorCode":null,"errorMessage":"npx requires a command argument","messagePattern":"npx requires a command argument","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main.rs","lineNumber":2315,"sourceCode":"            write_rules,\n            min_confidence,\n            min_occurrences,\n        } => {\n            learn::run(\n                project,\n                all,\n                since,\n                format,\n                write_rules,\n                min_confidence,\n                min_occurrences,\n            )?;\n            0\n        }\n\n        Commands::Npx { args } => {\n            if args.is_empty() {\n                anyhow::bail!(\"npx requires a command argument\");\n            }\n\n            // Intelligent routing: delegate to specialized filters\n            match args[0].as_str() {\n                \"tsc\" | \"typescript\" => tsc_cmd::run(&args[1..], cli.verbose)?,\n                \"eslint\" => lint_cmd::run(&args[1..], cli.verbose)?,\n                \"prisma\" => {\n                    // Route to prisma_cmd based on subcommand\n                    if args.len() > 1 {\n                        let prisma_args: Vec<String> = args[2..].to_vec();\n                        match args[1].as_str() {\n                            \"generate\" => prisma_cmd::run(\n                                prisma_cmd::PrismaCommand::Generate,\n                                &prisma_args,\n                                cli.verbose,\n                            )?,\n                            \"db\" if args.len() > 2 && args[2] == \"push\" => prisma_cmd::run(\n                                prisma_cmd::PrismaCommand::DbPush,","sourceCodeStart":2297,"sourceCodeEnd":2333,"githubUrl":"https://github.com/rtk-ai/rtk/blob/d977e1c31621fe8704e6500ceeb9c7a0de2b6836/src/main.rs#L2297-L2333","documentation":"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].","triggerScenarios":"`rtk npx` with no arguments — typically a wrapper interpolating an unset variable: `rtk npx $TOOL` with TOOL empty (src/main.rs:2317).","commonSituations":"Shell wrappers passing through optional arguments; docs placeholders never replaced; `set -u` not enabled so empty vars slip through.","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"],"exampleFix":"# before\nrtk npx \"$MAYBE_EMPTY\"\n\n# after\nrtk npx tsc --noEmit","handlingStrategy":"validation","validationCode":"# bash: guard before proxying to rtk npx\n[ $# -ge 1 ] && [ -n \"$1\" ] || { echo 'usage: rtk npx <cmd> [args...]' >&2; exit 2; }\nrtk npx \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use `set -u` in shell scripts so unset variables fail before reaching rtk","Default optional tool variables explicitly: `TOOL=${TOOL:-tsc}`"],"tags":["cli","npx","usage","arguments"],"backgroundTag":null,"analyzedSha":"d977e1c31621fe8704e6500ceeb9c7a0de2b6836","analyzedAt":"2026-08-16T05:40:46.291Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}