{"record":{"id":"bf8c8725aa0f4ef9","repo":"rtk-ai/rtk","slug":"dotnet-no-subcommand-specified","errorCode":null,"errorMessage":"dotnet: no subcommand specified","messagePattern":"dotnet: no subcommand specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmds/dotnet/dotnet_cmd.rs","lineNumber":79,"sourceCode":"    timer.track(\n        &format!(\"dotnet format {}\", args.join(\" \")),\n        &format!(\"rtk dotnet format {}\", args.join(\" \")),\n        &raw,\n        shown,\n    );\n\n    if cleanup_report_path {\n        if let Some(path) = report_path.as_deref() {\n            cleanup_temp_file(path);\n        }\n    }\n\n    Ok(result.exit_code)\n}\n\npub fn run_passthrough(args: &[OsString], verbose: u8) -> Result<i32> {\n    if args.is_empty() {\n        anyhow::bail!(\"dotnet: no subcommand specified\");\n    }\n\n    let timer = tracking::TimedExecution::start();\n    let subcommand = args[0].to_string_lossy().to_string();\n\n    let mut cmd = resolved_command(\"dotnet\");\n    cmd.env(DOTNET_CLI_UI_LANGUAGE, DOTNET_CLI_UI_LANGUAGE_VALUE);\n    cmd.arg(&subcommand);\n    for arg in &args[1..] {\n        cmd.arg(arg);\n    }\n\n    if verbose > 0 {\n        eprintln!(\"Running: dotnet {} ...\", subcommand);\n    }\n\n    let result =\n        exec_capture(&mut cmd).with_context(|| format!(\"Failed to run dotnet {}\", subcommand))?;","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/rtk-ai/rtk/blob/d977e1c31621fe8704e6500ceeb9c7a0de2b6836/src/cmds/dotnet/dotnet_cmd.rs#L61-L97","documentation":"RTK's dotnet passthrough handler requires at least one subcommand. run_passthrough bails before spawning `dotnet` when the args slice is empty, because a bare `rtk dotnet` has nothing to proxy or filter. The real `dotnet` CLI would print its help banner here, but RTK refuses rather than delegate an empty invocation.","triggerScenarios":"Running `rtk dotnet` with zero arguments, which hits `args.is_empty()` at src/cmds/dotnet/dotnet_cmd.rs:80. Typical producers: a wrapper script or alias forwarding an unset/empty variable (`rtk dotnet $DOTNET_ARGS` with DOTNET_ARGS empty), or an agent tool-call that drops the subcommand.","commonSituations":"CI scripts that assemble dotnet arguments dynamically and forward an empty vector; shell functions with `set -u` disabled letting an empty var expand to nothing; typos like `rtk dotnet ''`; wrapper scripts around `rtk dotnet \"$@\"` invoked with no positional args.","solutions":["Run rtk with an explicit dotnet subcommand: `rtk dotnet build`, `rtk dotnet test`, `rtk dotnet run`","If you only wanted dotnet's own help/banner, delegate unfiltered: `rtk proxy dotnet` or plain `dotnet --help`","Guard wrapper scripts before forwarding: `[ $# -gt 0 ] || { echo 'usage: rtk dotnet <subcommand>' >&2; exit 2; }`"],"exampleFix":"# before\nrtk dotnet            # args.is_empty() -> bail!(\"dotnet: no subcommand specified\")\n\n# after\nrtk dotnet build --no-restore\n# or let the bare CLI through unfiltered (still tracked in rtk gain)\nrtk proxy dotnet","handlingStrategy":"validation","validationCode":"bash:\n# before invoking rtk, make sure a subcommand exists\nif [ $# -eq 0 ]; then\n  echo \"usage: rtk dotnet <subcommand> [args...]\" >&2\n  exit 2\nfi\nrtk dotnet \"$@\"","typeGuard":"rust:\nfn has_dotnet_subcommand(args: &[std::ffi::OsString]) -> bool {\n    !args.is_empty()\n}","tryCatchPattern":"rust:\nmatch dotnet::run_passthrough(&args, verbose) {\n    Err(e) if e.to_string().contains(\"dotnet: no subcommand specified\") => {\n        eprintln!(\"usage: rtk dotnet <subcommand> [args...]\");\n        std::process::exit(2);\n    }\n    result => result?,\n}","preventionTips":["Always name the dotnet subcommand explicitly (build, test, run) when calling rtk","Quote and check dynamically-built argument arrays before forwarding to rtk","Prefer `rtk proxy dotnet` when you genuinely want the bare dotnet CLI behavior"],"tags":["dotnet","cli","usage","argument-validation"],"backgroundTag":null,"analyzedSha":"d977e1c31621fe8704e6500ceeb9c7a0de2b6836","analyzedAt":"2026-08-16T05:40:46.291Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}