{"record":{"id":"04f25d650526c0b4","repo":"rtk-ai/rtk","slug":"go-no-subcommand-specified","errorCode":null,"errorMessage":"go: no subcommand specified","messagePattern":"go: no subcommand specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmds/go/go_cmd.rs","lineNumber":128,"sourceCode":"        cmd.arg(arg);\n    }\n\n    if verbose > 0 {\n        eprintln!(\"Running: go vet {}\", args.join(\" \"));\n    }\n\n    runner::run_filtered(\n        cmd,\n        \"go vet\",\n        &args.join(\" \"),\n        filter_go_vet,\n        crate::core::runner::RunOptions::with_tee(\"go_vet\"),\n    )\n}\n\npub fn run_other(args: &[OsString], verbose: u8) -> Result<i32> {\n    if args.is_empty() {\n        anyhow::bail!(\"go: no subcommand specified\");\n    }\n\n    // Intercept: `go tool <known>` invocations for filtered output\n    if let Some((tool, tool_args)) = match_go_tool(args) {\n        match tool {\n            GoTool::GolangciLint => return run_go_tool_golangci_lint(tool_args, verbose),\n        }\n    }\n\n    let timer = tracking::TimedExecution::start();\n\n    let subcommand = args[0].to_string_lossy();\n    let mut cmd = resolved_command(\"go\");\n    cmd.arg(&*subcommand);\n\n    for arg in &args[1..] {\n        cmd.arg(arg);\n    }","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/rtk-ai/rtk/blob/d977e1c31621fe8704e6500ceeb9c7a0de2b6836/src/cmds/go/go_cmd.rs#L110-L146","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nrtk go                # bail!(\"go: no subcommand specified\")\n\n# after\nrtk go build ./...\nrtk go test ./... -run regex_filter","handlingStrategy":"validation","validationCode":"bash:\nif [ $# -eq 0 ]; then\n  echo \"usage: rtk go <verb> [args...]\" >&2\n  exit 2\nfi\nrtk go \"$@\"","typeGuard":"rust:\nfn has_go_verb(args: &[std::ffi::OsString]) -> bool {\n    !args.is_empty()\n}","tryCatchPattern":"rust:\nif let Err(e) = go_cmd::run_other(&args, verbose) {\n    if e.to_string().contains(\"go: no subcommand specified\") {\n        eprintln!(\"usage: rtk go <verb> (build | test | vet | run | ...)\");\n        std::process::exit(2);\n    }\n    return Err(e);\n}","preventionTips":["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`"],"tags":["go","golang","cli","usage","argument-validation"],"backgroundTag":null,"analyzedSha":"d977e1c31621fe8704e6500ceeb9c7a0de2b6836","analyzedAt":"2026-08-16T05:40:46.291Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}