rtk-ai/rtk · error
go: no subcommand specified
Error message
go: no subcommand specified
What it means
RTK's go handler run_other bails when the args slice is empty, before the `go tool` interception and subcommand forwarding run. A bare `rtk go` names no Go verb (build, test, vet...), so there is nothing to proxy or filter.
Source
Thrown at src/cmds/go/go_cmd.rs:128
cmd.arg(arg);
}
if verbose > 0 {
eprintln!("Running: go vet {}", args.join(" "));
}
runner::run_filtered(
cmd,
"go vet",
&args.join(" "),
filter_go_vet,
crate::core::runner::RunOptions::with_tee("go_vet"),
)
}
pub fn run_other(args: &[OsString], verbose: u8) -> Result<i32> {
if args.is_empty() {
anyhow::bail!("go: no subcommand specified");
}
// Intercept: `go tool <known>` invocations for filtered output
if let Some((tool, tool_args)) = match_go_tool(args) {
match tool {
GoTool::GolangciLint => return run_go_tool_golangci_lint(tool_args, verbose),
}
}
let timer = tracking::TimedExecution::start();
let subcommand = args[0].to_string_lossy();
let mut cmd = resolved_command("go");
cmd.arg(&*subcommand);
for arg in &args[1..] {
cmd.arg(arg);
}View on GitHub (pinned to d977e1c316)
Solutions
- Name the verb explicitly: `rtk go build ./...`, `rtk go test ./...`, `rtk go vet ./...`
- Delegate the bare invocation: `rtk proxy go` or `go help`
- Guard dynamic invocation: verify the verb variable is non-empty before calling rtk
Example fix
# before
rtk go # bail!("go: no subcommand specified")
# after
rtk go build ./...
rtk go test ./... -run regex_filter Defensive patterns
Strategy: validation
Validate before calling
bash: if [ $# -eq 0 ]; then echo "usage: rtk go <verb> [args...]" >&2 exit 2 fi rtk go "$@"
Type guard
rust:
fn has_go_verb(args: &[std::ffi::OsString]) -> bool {
!args.is_empty()
} Try / catch
rust:
if let Err(e) = go_cmd::run_other(&args, verbose) {
if e.to_string().contains("go: no subcommand specified") {
eprintln!("usage: rtk go <verb> (build | test | vet | run | ...)");
std::process::exit(2);
}
return Err(e);
} Prevention
- Always include the Go verb (build/test/vet/run) in the rtk invocation
- Audit Makefile targets that interpolate the verb conditionally
- Probe with `go help` or `rtk proxy go`, not bare `rtk go`
When it happens
Trigger: Running `rtk go` with zero arguments (src/cmds/go/go_cmd.rs:129). Also wrappers forwarding an empty array, or `rtk go $GO_ARGS` with GO_ARGS empty.
Common situations: Makefile targets like `rtk go $(GOFLAGS) build` where GOFLAGS is empty and build is accidentally dropped; CI matrices generating the verb conditionally; agents invoking the bare command while probing.
Related errors
- dotnet: no subcommand specified
- sbt: no subcommand specified
- gt: no subcommand specified
- --codex cannot be combined with --opencode
- --codex cannot be combined with --claude-md
AI-assisted analysis of rtk-ai/rtk@d977e1c316 (2026-08-16).
Data as JSON: /api/errors/04f25d650526c0b4.
Report an issue: GitHub.