BurntSushi/ripgrep · error
A path separator must be exactly one byte, but the given sep
Error message
A path separator must be exactly one byte, but the given separator is {len} bytes: {sep}
In some shells on Windows '/' is automatically expanded. Use '//' instead. What it means
Error "A path separator must be exactly one byte, but the given separator is {len} bytes: {sep} In some shells on Windows '/' is automatically expanded. Use '//' instead." thrown in BurntSushi/ripgrep.
Source
Thrown at crates/core/flags/defs.rs:5599
Set the path separator to use when printing file paths. This defaults to your
platform's path separator, which is \fB/\fP on Unix and \fB\\\fP on Windows.
This flag is intended for overriding the default when the environment demands
it (e.g., cygwin). A path separator is limited to a single byte.
.sp
Setting this flag to an empty string reverts it to its default behavior. That
is, the path separator is automatically chosen based on the environment.
"
}
fn update(&self, v: FlagValue, args: &mut LowArgs) -> anyhow::Result<()> {
let s = convert::string(v.unwrap_value())?;
let raw = Vec::unescape_bytes(&s);
args.path_separator = if raw.is_empty() {
None
} else if raw.len() == 1 {
Some(raw[0])
} else {
anyhow::bail!(
"A path separator must be exactly one byte, but \
the given separator is {len} bytes: {sep}\n\
In some shells on Windows '/' is automatically \
expanded. Use '//' instead.",
len = raw.len(),
sep = s,
)
};
Ok(())
}
}
#[cfg(test)]
#[test]
fn test_path_separator() {
let args = parse_low_raw(None::<&str>).unwrap();
assert_eq!(None, args.path_separator);
View on GitHub (pinned to 3fce3b5bb0)
Solutions
- Provide a path separator that is exactly one byte
- On Windows shells that expand '/', use '//' as the separator instead
When it happens
Trigger: Thrown at crates/core/flags/defs.rs:5599 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BurntSushi/ripgrep@3fce3b5bb0 (2026-08-06).
Data as JSON: /data/errors/c63c18d2948ed932.json.
Report an issue: GitHub.