{"id":"c63c18d2948ed932","repo":"BurntSushi/ripgrep","slug":"a-path-separator-must-be-exactly-one-byte-but-the","errorCode":null,"errorMessage":"A path separator must be exactly one byte, but the given separator is {len} bytes: {sep}\nIn some shells on Windows '/' is automatically expanded. Use '//' instead.","messagePattern":"A path separator must be exactly one byte, but the given separator is (.+?) bytes: (.+?)\nIn some shells on Windows '/' is automatically expanded\\. Use '//' instead\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/core/flags/defs.rs","lineNumber":5599,"sourceCode":"Set the path separator to use when printing file paths. This defaults to your\nplatform's path separator, which is \\fB/\\fP on Unix and \\fB\\\\\\fP on Windows.\nThis flag is intended for overriding the default when the environment demands\nit (e.g., cygwin). A path separator is limited to a single byte.\n.sp\nSetting this flag to an empty string reverts it to its default behavior. That\nis, the path separator is automatically chosen based on the environment.\n\"\n    }\n\n    fn update(&self, v: FlagValue, args: &mut LowArgs) -> anyhow::Result<()> {\n        let s = convert::string(v.unwrap_value())?;\n        let raw = Vec::unescape_bytes(&s);\n        args.path_separator = if raw.is_empty() {\n            None\n        } else if raw.len() == 1 {\n            Some(raw[0])\n        } else {\n            anyhow::bail!(\n                \"A path separator must be exactly one byte, but \\\n                 the given separator is {len} bytes: {sep}\\n\\\n                 In some shells on Windows '/' is automatically \\\n                 expanded. Use '//' instead.\",\n                len = raw.len(),\n                sep = s,\n            )\n        };\n        Ok(())\n    }\n}\n\n#[cfg(test)]\n#[test]\nfn test_path_separator() {\n    let args = parse_low_raw(None::<&str>).unwrap();\n    assert_eq!(None, args.path_separator);\n","sourceCodeStart":5581,"sourceCodeEnd":5617,"githubUrl":"https://github.com/BurntSushi/ripgrep/blob/3fce3b5bb0236da2df6d99672afb8a719642eca7/crates/core/flags/defs.rs#L5581-L5617","documentation":"Error \"A path separator must be exactly one byte, but the given separator is {len} bytes: {sep}\nIn some shells on Windows '/' is automatically expanded. Use '//' instead.\" thrown in BurntSushi/ripgrep.","triggerScenarios":"Thrown at crates/core/flags/defs.rs:5599 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a path separator that is exactly one byte","On Windows shells that expand '/', use '//' as the separator instead"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"3fce3b5bb0236da2df6d99672afb8a719642eca7","analyzedAt":"2026-08-06T01:39:05.073Z","schemaVersion":2}