rtk-ai/rtk · error

dotnet: no subcommand specified

Error message

dotnet: no subcommand specified

What it means

`run_passthrough` in the dotnet filter requires at least one argument (the subcommand, e.g. `build`, `test`) after `rtk dotnet`. When the args slice is empty there is nothing to proxy to `dotnet`, so the function bails with this error instead of spawning a command with no arguments.

Solutions

  1. Pass a subcommand: e.g. `rtk dotnet build` or `rtk dotnet test`.
  2. If you need unfiltered behavior with arguments, use `rtk proxy dotnet <subcommand> [args...]`.
  3. Fix the calling wrapper/hook so it forwards its arguments to rtk instead of invoking `rtk dotnet` bare.
  4. Update the dispatcher so an empty args case prints usage (`rtk dotnet <command> [args...]`) instead of surfacing this error.

Example fix

// before
rtk dotnet

// after
rtk dotnet build -bl
Defensive patterns

Strategy: validation

Validate before calling

// guard before invoking the dotnet filter
const args: string[] = process.argv.slice(2);
if (args[0] !== "dotnet" || args.length < 2) {
  throw new Error("usage: rtk dotnet <subcommand> [args...]");
}

Try / catch

match rtk_dotnet(&args) {
    Ok(code) => std::process::exit(code),
    Err(e) if e.to_string().contains("no subcommand specified") => {
        eprintln!("usage: rtk dotnet <build|test|run|...> [args...]");
        std::process::exit(2);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Invoking `rtk dotnet` with no subcommand and no arguments — the internal dispatch reaches `run_passthrough(&[], ...)`.

Common situations: A wrapper script or hook that strips arguments before calling rtk; a shell alias dropping args; a user typing `rtk dotnet` expecting interactive `dotnet` behavior; misconfigured MCP/tooling integration that forwards an empty argv.

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/bf8c8725aa0f4ef9. Report an issue: GitHub.

Appendix: source

Thrown at src/cmds/dotnet/dotnet_cmd.rs:81

    println!("{}", shown);

    timer.track(
        &format!("dotnet format {}", args.join(" ")),
        &format!("rtk dotnet format {}", args.join(" ")),
        &raw,
        shown,
    );

    if cleanup_report_path && let Some(path) = report_path.as_deref() {
        cleanup_temp_file(path);
    }

    Ok(result.exit_code)
}

pub fn run_passthrough(args: &[OsString], verbose: u8) -> Result<i32> {
    if args.is_empty() {
        anyhow::bail!("dotnet: no subcommand specified");
    }

    let timer = tracking::TimedExecution::start();
    let subcommand = args[0].to_string_lossy().to_string();

    let mut cmd = resolved_command("dotnet");
    cmd.env(DOTNET_CLI_UI_LANGUAGE, DOTNET_CLI_UI_LANGUAGE_VALUE);
    cmd.arg(&subcommand);
    for arg in &args[1..] {
        cmd.arg(arg);
    }

    if verbose > 0 {
        eprintln!("Running: dotnet {} ...", subcommand);
    }

    let result =
        exec_capture(&mut cmd).with_context(|| format!("Failed to run dotnet {}", subcommand))?;

View on GitHub (pinned to 0924356b4c)