{"record":{"id":"e0cf8038ca61aa06","repo":"zed-industries/zed","slug":"invalid-relative-path-path","errorCode":null,"errorMessage":"invalid relative path {path:?}","messagePattern":"invalid relative path (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/path/src/rel_path.rs","lineNumber":127,"sourceCode":"\n        Ok(result)\n    }\n\n    #[track_caller]\n    pub fn new_test<'a>(path: &'a str) -> Cow<'a, Self> {\n        Self::new(Path::new(path), PathStyle::Unix).unwrap()\n    }\n\n    /// Converts a path that is already normalized and uses '/' separators\n    /// into a [`RelPath`] .\n    ///\n    /// Returns an error if the path is not already in the correct format.\n    #[track_caller]\n    pub fn from_unix_str<S: AsRef<Path> + ?Sized>(path: &S) -> anyhow::Result<&Self> {\n        let path = path.as_ref();\n        match Self::new(path, PathStyle::Unix)? {\n            Cow::Borrowed(path) => Ok(path),\n            Cow::Owned(_) => Err(anyhow!(\"invalid relative path {path:?}\")),\n        }\n    }\n\n    fn from_str(s: &str) -> &Self {\n        // Safety: `RelPath` is a transparent wrapper around `str`.\n        unsafe { &*(s as *const str as *const Self) }\n    }\n\n    pub fn is_empty(&self) -> bool {\n        self.0.is_empty()\n    }\n\n    pub fn components(&self) -> RelPathComponents<'_> {\n        RelPathComponents(&self.0)\n    }\n\n    pub fn ancestors(&self) -> RelPathAncestors<'_> {\n        RelPathAncestors {","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/path/src/rel_path.rs#L109-L145","documentation":"from_unix_str requires an already-normalized, '/'-separated relative path, and RelPath::new rejected the input (absolute path, empty/dot components, or '..' traversal). This is a strict validation helper: callers promise pre-normalized input, and this error means that promise was broken.","triggerScenarios":"Thrown at crates/path/src/rel_path.rs:127 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Normalize the string before calling from_unix_str (resolve '.', '..', and empty segments)","Ensure the input is actually relative and uses '/' separators, not the platform separator","Audit callers that pass user or persisted data instead of trusted normalized paths"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}