{"record":{"id":"445ad27b000f25d2","repo":"rtk-ai/rtk","slug":"gt-no-subcommand-specified","errorCode":null,"errorMessage":"gt: no subcommand specified","messagePattern":"gt: no subcommand specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmds/git/gt_cmd.rs","lineNumber":127,"sourceCode":"pub fn run_sync(args: &[String], verbose: u8) -> Result<i32> {\n    run_gt_filtered(&[\"sync\"], args, verbose, \"gt_sync\", filter_gt_sync)\n}\n\npub fn run_restack(args: &[String], verbose: u8) -> Result<i32> {\n    run_gt_filtered(&[\"restack\"], args, verbose, \"gt_restack\", filter_gt_restack)\n}\n\npub fn run_create(args: &[String], verbose: u8) -> Result<i32> {\n    run_gt_filtered(&[\"create\"], args, verbose, \"gt_create\", filter_gt_create)\n}\n\npub fn run_branch(args: &[String], verbose: u8) -> Result<i32> {\n    run_gt_filtered(&[\"branch\"], args, verbose, \"gt_branch\", filter_identity)\n}\n\npub fn run_other(args: &[OsString], verbose: u8) -> Result<i32> {\n    if args.is_empty() {\n        anyhow::bail!(\"gt: no subcommand specified\");\n    }\n\n    let subcommand = args[0].to_string_lossy();\n    let rest: Vec<String> = args[1..]\n        .iter()\n        .map(|a| a.to_string_lossy().into())\n        .collect();\n\n    // gt passes unknown subcommands to git, so \"gt status\" = \"git status\".\n    // Route known git commands to RTK's git filters for token savings.\n    match subcommand.as_ref() {\n        \"status\" => crate::git::run(crate::git::GitCommand::Status, &rest, None, verbose, &[]),\n        \"diff\" => crate::git::run(crate::git::GitCommand::Diff, &rest, None, verbose, &[]),\n        \"show\" => crate::git::run(crate::git::GitCommand::Show, &rest, None, verbose, &[]),\n        \"add\" => crate::git::run(crate::git::GitCommand::Add, &rest, None, verbose, &[]),\n        \"push\" => crate::git::run(crate::git::GitCommand::Push, &rest, None, verbose, &[]),\n        \"pull\" => crate::git::run(crate::git::GitCommand::Pull, &rest, None, verbose, &[]),\n        \"fetch\" => crate::git::run(crate::git::GitCommand::Fetch, &rest, None, verbose, &[]),","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/rtk-ai/rtk/blob/d977e1c31621fe8704e6500ceeb9c7a0de2b6836/src/cmds/git/gt_cmd.rs#L109-L145","documentation":"RTK's gt (Graphite) handler run_other requires at least one subcommand and bails on an empty args slice before doing anything. Known subcommands (create, branch) go through dedicated filtered paths; unknown ones are forwarded to git routing, but an empty invocation has no route at all.","triggerScenarios":"Running `rtk gt` with zero arguments (src/cmds/git/gt_cmd.rs:128 `args.is_empty()`). Also `rtk gt \"$GT_CMD\"` where GT_CMD is unset, or a wrapper function invoked without positionals.","commonSituations":"Shell wrappers that conditionally build the gt command and forward it unquoted; agents calling `rtk gt` bare expecting a help screen; scripts copied from a context where the subcommand variable was populated.","solutions":["Pass a subcommand: `rtk gt create`, `rtk gt submit`, or a git-backed one like `rtk gt status` (routed to RTK's git filter)","Use `rtk proxy gt` for gt's own bare-CLI behavior","Check for non-empty args in wrapper scripts before calling rtk"],"exampleFix":"# before\nrtk gt               # bail!(\"gt: no subcommand specified\")\n\n# after\nrtk gt create --merge\n# unknown subcommands are forwarded to git, so this also works:\nrtk gt status        # == git status, token-optimized","handlingStrategy":"validation","validationCode":"bash:\nif [ $# -eq 0 ]; then\n  echo \"usage: rtk gt <subcommand> [args...]\" >&2\n  exit 2\nfi\nrtk gt \"$@\"","typeGuard":"rust:\nfn has_gt_subcommand(args: &[std::ffi::OsString]) -> bool {\n    !args.is_empty()\n}","tryCatchPattern":"rust:\nif let Err(e) = gt_cmd::run_other(&args, verbose) {\n    if e.to_string().contains(\"gt: no subcommand specified\") {\n        eprintln!(\"usage: rtk gt <subcommand> (create, submit, or any git command)\");\n        std::process::exit(2);\n    }\n    return Err(e);\n}","preventionTips":["Pass a concrete gt verb (create, submit, sync) or a git-routable one (status, log)","Check forwarded variables are non-empty before `rtk gt $VAR`","Use `rtk proxy gt` for bare gt behavior"],"tags":["gt","graphite","git","cli","usage"],"backgroundTag":null,"analyzedSha":"d977e1c31621fe8704e6500ceeb9c7a0de2b6836","analyzedAt":"2026-08-16T05:40:46.291Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}