You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Panic (SIGABRT, exit 134) on non-UTF-8 bytes in argv — std::env::args() unwrap #3025
First off — thank you for maintaining rtk. The 0.43 releases (the never-worse output guard, the grep engine fix) have made it noticeably more trustworthy in day-to-day agent use, and that work is appreciated.
Summary
rtk aborts with a Rust panic (SIGABRT, exit 134) when any command-line argument contains bytes that aren't valid UTF-8. The panic fires in std::env::args()'s per-argument unwrap, before the wrapped command runs.
Reproduction (rtk 0.43.0, macOS arm64, zsh)
The pattern below is the leading bytes of a double-encoded UTF-8 sequence — the kind of byte fragment you end up grepping for when hunting mojibake in a repo, which is how we hit this in real work:
$ printf'\xc3\xa2\xe2\x80\xa0\n'| rtk grep -c $'\xc3\xa2\xe2\x80'thread 'main' panicked at /rustc/.../library/std/src/env.rs:875:51:called `Result::unwrap()` on an `Err` value: "â\xE2\x80"note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
$ echo$?134
Expected
Either pass the raw bytes through to the underlying engine (system grep handles them fine under LC_ALL=C), or exit with a normal, clear error message — anything but an abort.
Notes
Reproduced on two different days on 0.43.0 (macOS arm64).
Non-UTF-8 bytes in argv cause std::env::args() unwrap panic (SIGABRT/exit 134) before the wrapped command runs; switch to args_os() with lossy/graceful handling.
This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.
📁 Relevant files
src/main.rs
Triaged automatically by wshm · This is an automated analysis, not a human review.
Opened #3224 for this. Root cause is run_fallback in src/main.rs calling std::env::args(), which aborts on any non-UTF-8 argument. The uses args_os()/OsString so the original bytes are reproduced unchanged. It derives lossy strings only for display. restore_double_dash in src/core/args_utils.rs had the same call problem and I made the same fix there.
One more reach for this, from #4727 (rtk ruff now calls restore_double_dash, which reads std::env::args()): with rtk invoked by an absolute path whose directory name is not UTF-8, rtk ruff check sub panics (exit 101) on that head, where develop 5ab6291 ran it. rtk git status from the same binary already panics on develop for the same reason. Invoked by name through PATH (argv[0] = rtk, the hook's form), neither panics. #3224 switches restore_double_dash to args_os(), which covers this call too.
Still reproduces on rtk 1.1.0 (macOS arm64, zsh), the current release: rtk grep -c $'\xf0\x9d' <file> panics with called Result::unwrap() on an Err value: "\xF0\x9D" and exits 101. We hit it through the Claude Code hook, which routes ordinary shell commands through rtk, so the agent's command fails outright. #3224 would fix it.
Activity
pszymkowiak commentedon Jul 16, 2026
🔍 Automated Triage
bughighSummary
Non-UTF-8 bytes in argv cause std::env::args() unwrap panic (SIGABRT/exit 134) before the wrapped command runs; switch to args_os() with lossy/graceful handling.
📁 Relevant files
src/main.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
mgwedd commentedon Jul 26, 2026
Opened #3224 for this. Root cause is
run_fallbackinsrc/main.rscallingstd::env::args(), which aborts on any non-UTF-8 argument. The usesargs_os()/OsStringso the original bytes are reproduced unchanged. It derives lossy strings only for display.restore_double_dashinsrc/core/args_utils.rshad the same call problem and I made the same fix there.KuSh commentedon Oct 23, 2026
One more reach for this, from #4727 (
rtk ruffnow callsrestore_double_dash, which readsstd::env::args()): with rtk invoked by an absolute path whose directory name is not UTF-8,rtk ruff check subpanics (exit 101) on that head, where develop 5ab6291 ran it.rtk git statusfrom the same binary already panics on develop for the same reason. Invoked by name throughPATH(argv[0] =rtk, the hook's form), neither panics. #3224 switchesrestore_double_dashtoargs_os(), which covers this call too.guryanov-a commentedon Nov 5, 2026
Still reproduces on rtk 1.1.0 (macOS arm64, zsh), the current release:
rtk grep -c $'\xf0\x9d' <file>panics withcalled Result::unwrap() on an Err value: "\xF0\x9D"and exits 101. We hit it through the Claude Code hook, which routes ordinary shell commands through rtk, so the agent's command fails outright. #3224 would fix it.Written by Claude Opus 5.5 in Claude Code