Skip to content

Documented -u (--ultra-compact) shorthand is not implemented — unknown global flags exec-fail with ENOENT / exit 127 instead of a parse error #2369

Closed as duplicate

Description

@simopala82

Description

The README documents a -u shorthand for --ultra-compact (README.md, "Options" quick ref):

-u, --ultra-compact    # ASCII icons, inline format (extra token savings)

But the CLI only defines the long flag. rtk --help shows:

      --ultra-compact
          Ultra-compact mode: ASCII icons, inline format (Level 2 optimizations)

Running rtk -u <cmd> fails with exit 127 and an ENOENT message.

This is not specific to -u: any unknown global flag (e.g. rtk -z grep ...) fails the same way. So unknown global args seem to fall through to the external-command exec path instead of being rejected by the argument parser.

Repro steps

printf 'master\nfeat/x\n' > /tmp/branches.txt

rtk -u grep master /tmp/branches.txt
# [rtk: No such file or directory (os error 2)]
# exit code: 127

rtk -u read /tmp/branches.txt
# [rtk: No such file or directory (os error 2)]
# exit code: 127

rtk -z grep master /tmp/branches.txt   # any unknown global flag, same failure
# [rtk: No such file or directory (os error 2)]
# exit code: 127

# long form works fine:
rtk --ultra-compact grep master /tmp/branches.txt
rtk --ultra-compact read /tmp/branches.txt

Expected

Either:

  • rtk -u works as the README documents, or
  • if -u is not meant to exist, drop it from the README, and unknown flags should get a normal parse error (unexpected argument '-u') instead of ENOENT + exit 127.

Actual

[rtk: No such file or directory (os error 2)], exit 127. The message suggests rtk tried to exec -u as an external command.

Version / environment

  • rtk 0.42.0 (Homebrew), macOS arm64 (Darwin 25.5.0), reproduced 2026-06-10
  • No related fix in CHANGELOG up to 0.42.3, and -u is still absent from --help

Possibly related: #2095 reports the same os error 2 failure at startup for rtk json / rtk smart / rtk telemetry, which also looks like arguments falling into a wrong exec/file-lookup path.

Activity

  1. pszymkowiak commented on Jun 10, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟡 Priority medium
    🎯 Confidence 91%

    Summary

    Two related bugs: -u shorthand documented in README but missing from CLI parser, and unknown global flags fall through to the exec path (ENOENT/exit 127) instead of producing a parse error.

    📁 Relevant files
    • src/cli.rs
    • src/main.rs
    • README.md

    Triaged automatically by wshm · This is an automated analysis, not a human review.

  2. hgunduzoglu commented on Jun 17, 2026

    @hgunduzoglu
    Contributor

    I reproduced this on develop (0.42.2, macOS arm64) and looked into the fix. There's a non-obvious tradeoff worth flagging before someone implements it, because the obvious one-line fix introduces a regression.

    Confirmed: rtk -u <cmd> falls through to the external-exec path; rtk --ultra-compact <cmd> works. The ultra_compact field in src/main.rs has long but no short.

    The catch: the field is #[arg(long, global = true)]. Adding short = 'u' to a global flag makes -u shadow git's own -u after the subcommand:

    # with short='u' added (global):
    $ rtk git log -u        # git's -u = show patch  -> swallowed by rtk, no patch
    $ rtk git push -u ...    # git's -u = --set-upstream -> silently dropped

    I verified this with a parse-level test: rtk git log -u parses to ultra_compact=true with empty git args, instead of passing -u to git. So the naive fix trades a missing flag for silently breaking git log -u / git push -u / git stash -u.

    The two clean options each have a cost:

    1. Keep global = true, add short = 'u' — matches the existing doc caveat (what-rtk-covers.md: "use --ultra-compact rather than -u with Git"), but silently shadows git's -u, which violates the transparency principle for agents running git push -u.
    2. Make the flag non-global, add short = 'u' (consistent with how verbose is "only recognized before the subcommand") — rtk -u <cmd> and rtk --ultra-compact <cmd> work, git's -u is untouched, but post-subcommand rtk gh pr list --ultra-compact would stop being captured. Since ultra_compact is only consumed by gh/glab (not git), the blast radius is small, and git log --ultra-compact is already a swallowed no-op today.

    I'd lean toward option 2 (non-global, plus a doc tweak), but it's a behavior change that's really your call. Happy to send a PR for whichever you prefer.

  3. KuSh commented on Sep 13, 2026

    @KuSh
    Collaborator

    Closing as a duplicate of #3426, which tracks the same problem with the more complete discussion. Please follow up there; if your case differs in a way that issue does not cover, comment here and it can be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions