{"record":{"id":"70b8f61467783a78","repo":"BoundaryML/baml","slug":"unsupported-native-path-prefix-0","errorCode":null,"errorMessage":"unsupported native path prefix: {0}","messagePattern":"unsupported native path prefix: (.+?)","errorType":"exception","errorClass":"FsPathError","httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_path/src/lib.rs","lineNumber":39,"sourceCode":"\n    pub fn as_str(&self) -> &str {\n        &self.0\n    }\n\n    pub fn into_string(self) -> String {\n        self.0\n    }\n}\n\n#[derive(Debug, thiserror::Error)]\npub enum FsPathError {\n    #[error(\"native path is not absolute: {0}\")]\n    NotAbsolute(PathBuf),\n\n    #[error(\"native path is not valid Unicode: {0:?}\")]\n    NonUnicode(PathBuf),\n\n    #[error(\"unsupported native path prefix: {0}\")]\n    UnsupportedPrefix(PathBuf),\n\n    #[error(\"invalid VFS path: {0}\")]\n    InvalidVfsPath(String),\n}\n\nimpl From<FsPathError> for vfs::VfsError {\n    fn from(error: FsPathError) -> Self {\n        vfs::VfsError::from(vfs::error::VfsErrorKind::Other(error.to_string()))\n    }\n}\n\nfn validate_vfs_path(path: &str) -> Result<(), FsPathError> {\n    if path == \"/\" {\n        return Ok(());\n    }\n\n    let invalid = !path.starts_with('/')","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_path/src/lib.rs#L21-L57","documentation":"FsPathError::UnsupportedPrefix is returned when a native path uses a prefix form baml_path does not support, e.g. Windows verbatim (\\\\?\\C:\\...) or device namespace (\\\\.\\) prefixes. Such paths cannot be mapped into the VFS path scheme.","triggerScenarios":"On Windows, passing paths produced by dunce-less canonicalization that yield \\\\?\\ verbatim form, or UNC/device paths (\\\\.\\pipe\\..., \\\\?\\UNC\\server\\share) into native->VFS conversion.","commonSituations":"Using std::fs::canonicalize on Windows (returns \\\\?\\ prefixed paths) before handing the result to baml_path; working with network shares or named pipes; junctions resolved to verbatim form.","solutions":["Strip the \\\\?\\ verbatim prefix before conversion (or use the dunce crate's canonicalize which avoids verbatim form).","Use a normal drive-letter path (C:\\project\\file.baml) instead of a device/namespace path.","Don't point the project at UNC/network shares; copy it to a local drive path.","Normalize the path with a helper that removes unsupported prefixes at the boundary."],"exampleFix":"// before\nlet p = std::fs::canonicalize(r\"C:\\proj\\main.baml\")?; // \\\\?\\C:\\proj\\main.baml\n\n// after\nlet p = dunce::canonicalize(r\"C:\\proj\\main.baml\")?; // C:\\proj\\main.baml","handlingStrategy":"validation","validationCode":"fn has_unsupported_prefix(p: &std::path::Path) -> bool {\n    let s = p.as_os_str().to_string_lossy();\n    s.starts_with(\"\\\\\\\\?\\\\\") || s.starts_with(\"\\\\\\\\.\\\\\")\n}\n// strip or reject before conversion","typeGuard":"fn is_plain_windows_path(p: &std::path::Path) -> bool {\n    let s = p.as_os_str().to_string_lossy();\n    !s.starts_with(\"\\\\\\\\?\\\\\") && !s.starts_with(\"\\\\\\\\.\\\\\")\n}","tryCatchPattern":null,"preventionTips":["Use dunce::canonicalize instead of std::fs::canonicalize on Windows","Avoid placing projects on UNC/network shares or device paths","Normalize verbatim prefixes away at the path-ingestion boundary"],"tags":["rust","filesystem","windows","path"],"backgroundTag":"unsupported-operation","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}