{"record":{"id":"11767fb0800c65df","repo":"zed-industries/zed","slug":"path-is-not-relative-result","errorCode":null,"errorMessage":"path is not relative: {result:?}","messagePattern":"path is not relative: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/path/src/rel_path.rs","lineNumber":101,"sourceCode":"        }\n\n        let mut result = match string {\n            Cow::Borrowed(string) => Cow::Borrowed(Self::from_str(string)),\n            Cow::Owned(string) => Cow::Owned(RelPathBuf(string)),\n        };\n\n        if result\n            .components()\n            .any(|component| component == \"\" || component == \".\" || component == \"..\")\n        {\n            let mut normalized = RelPathBuf::new();\n            for component in result.components() {\n                match component {\n                    \"\" => {}\n                    \".\" => {}\n                    \"..\" => {\n                        if !normalized.pop() {\n                            return Err(anyhow!(\"path is not relative: {result:?}\"));\n                        }\n                    }\n                    other => normalized.push(RelPath::from_str(other)),\n                }\n            }\n            result = Cow::Owned(normalized)\n        }\n\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`] .","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/path/src/rel_path.rs#L83-L119","documentation":"After normalization, RelPath::new determined the resulting path still escapes its invariants — normalization of '.' and '..' components would climb above the root or leave an invalid relative form. The offending normalized result is printed; typically the input contained a leading or excess '..'.","triggerScenarios":"Thrown at crates/path/src/rel_path.rs:101 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove leading '..' components from the input; a RelPath must stay within its base","Reject or sanitize user-supplied relative paths that traverse above the root","If reading from storage, audit writes that allowed un-normalized paths to be persisted"],"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"}