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
rtk find panics on non-ASCII path (byte index not a char boundary, find_cmd.rs:326) when an unknown flag like -print is present #2851
rtk find panics with byte index is not a char boundary when BOTH conditions are met:
the command line contains a flag rtk doesn't know (e.g. -print, which rtk warns about and ignores), and
a matching file lives under a directory whose name contains a multi-byte UTF-8 character (e.g. é).
Without the unknown flag, the same search works fine, so the buggy slice seems to be on the unknown-flag recovery path.
Environment
rtk 0.43.0 (installed at ~/.local/bin/rtk)
macOS (Darwin 25.5.0, Apple Silicon)
invoked through the Claude Code hook (transparent find → rtk find rewrite), but reproduces in a plain shell
Minimal reproduction
mkdir -p 'Les Plongées de Juliette/5-Pipeline/Versions-imprimables'
touch 'Les Plongées de Juliette/5-Pipeline/Versions-imprimables/LES-PLONGEES_Index-Tableau-de-Bord.pdf'
rtk find . -name '*Index-Tableau-de-Bord.pdf' -print
Output:
rtk find: unknown flag '-print', ignored
thread 'main' (312487) panicked at src/cmds/system/find_cmd.rs:326:34:
start byte index 10 is not a char boundary; it is inside 'é' (bytes 9..11 of string)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Removing -print makes the same command succeed and print the match.
Notes
"Les Plong" is exactly 9 bytes, so the é sits at bytes 9..11 and a [..10] byte slice lands mid-character — the truncation at find_cmd.rs:326 should use a char-boundary-safe cut (floor_char_boundary-style loop or char_indices).
Real-world impact: Claude Code rewrites find to rtk find transparently, and -print is a very common (and POSIX-default) find flag, so any vault/repo with accented directory names (French, German, Spanish…) hits this.
rtk find panics (non-char-boundary byte slice) at find_cmd.rs:326 on unknown-flag recovery path when a matched path contains multi-byte UTF-8; fix by using a char-boundary-safe truncation helper (potentially shared with #2318/#2509 sibling bugs).
This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.
📁 Relevant files
src/cmds/system/find_cmd.rs
Triaged automatically by wshm · This is an automated analysis, not a human review.
Correction to my own report while preparing the fix: the unknown flag (-print) is a red herring. The actual trigger is the grouped-results display truncating any matched directory path longer than 50 bytes when a multi-byte UTF-8 character straddles the cut point (dir.len() - 47). My first minimal repro didn't panic simply because its path was under 50 bytes — the flag just happened to differ between my two attempts.
Fix in #2852: ceil_char_boundary() on the cut, same pattern as the fixes for #2318/#2509, with regression tests.
This was fixed by the find rewrite that shipped in v0.46.0: the grouped directory label is now truncated on character boundaries instead of byte offsets, and there is a regression test with a long accented directory name. Running your reproduction on the current build prints the match and the grouped listing without panicking, both with and without -print. Please comment or reopen if you still see it on the latest version.
Activity
pszymkowiak commentedon Jul 6, 2026
🔍 Automated Triage
bughighSummary
rtk find panics (non-char-boundary byte slice) at find_cmd.rs:326 on unknown-flag recovery path when a matched path contains multi-byte UTF-8; fix by using a char-boundary-safe truncation helper (potentially shared with #2318/#2509 sibling bugs).
📁 Relevant files
src/cmds/system/find_cmd.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
Revlochon commentedon Jul 6, 2026
Correction to my own report while preparing the fix: the unknown flag (
-print) is a red herring. The actual trigger is the grouped-results display truncating any matched directory path longer than 50 bytes when a multi-byte UTF-8 character straddles the cut point (dir.len() - 47). My first minimal repro didn't panic simply because its path was under 50 bytes — the flag just happened to differ between my two attempts.Fix in #2852:
ceil_char_boundary()on the cut, same pattern as the fixes for #2318/#2509, with regression tests.KuSh commentedon Sep 19, 2026
This was fixed by the find rewrite that shipped in v0.46.0: the grouped directory label is now truncated on character boundaries instead of byte offsets, and there is a regression test with a long accented directory name. Running your reproduction on the current build prints the match and the grouped listing without panicking, both with and without -print. Please comment or reopen if you still see it on the latest version.