{"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":2765,"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(Some(\"npx\"), &args[1..], cli.verbose)?,\n                \"eslint\" => lint_cmd::run(Some(\"npx\"), &args, 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":2747,"sourceCodeEnd":2783,"githubUrl":"https://github.com/rtk-ai/rtk/blob/0924356b4caba4989607227b7c8824d3d8098719/src/main.rs#L2747-L2783","documentation":"`rtk npx` proxies npm's `npx`, which needs a package/binary plus command to execute. When the args vector after `npx` is empty, src/main.rs:2765 bails with `anyhow::bail!` because there is nothing to route to the specialized filters (tsc, eslint, etc.) or the passthrough executor.","triggerScenarios":"Running `rtk npx` with no further arguments (e.g. typing `rtk npx` alone, or a script building the command from a variable that ended up empty).","commonSituations":"A shell variable holding the package name is unset (`rtk npx $PKG`); a fat command alias lost its arguments; forgetting that unlike bare `npx` (which prints help), rtk requires an explicit command.","solutions":["Pass the command you want to run, e.g. `rtk npx vitest run` or `rtk npx tsc --noEmit`","Check that any variable interpolated into the command is non-empty before invoking","Use plain `npx --help` (outside rtk) if you only wanted npx usage information"],"exampleFix":"// before (PKG empty)\nrtk npx $PKG\n// after\nrtk npx vitest run","handlingStrategy":"validation","validationCode":"// shell: require a non-empty command before invoking rtk npx\nif [ -z \"${1:-}\" ]; then echo \"usage: rtk npx <command> [args...]\" >&2; exit 1; fi\nrtk npx \"$@\"","typeGuard":null,"tryCatchPattern":"// Rust caller\nif args.is_empty() {\n    eprintln!(\"rtk npx requires a command, e.g. rtk npx tsc --noEmit\");\n    std::process::exit(2);\n}\nrtk_npx(&args)?;","preventionTips":["Always quote/verify interpolated variables before `rtk npx $VAR`","Invoke rtk npx with at least a binary name plus args","Add usage text in wrapper scripts when arg count is 0"],"tags":["cli","npx","missing-argument"],"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"}