BoundaryML/baml · error · FsPathError
unsupported native path prefix: {0}
Error message
unsupported native path prefix: {0} What it means
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.
Source
Thrown at baml_language/crates/baml_path/src/lib.rs:39
pub fn as_str(&self) -> &str {
&self.0
}
pub fn into_string(self) -> String {
self.0
}
}
#[derive(Debug, thiserror::Error)]
pub enum FsPathError {
#[error("native path is not absolute: {0}")]
NotAbsolute(PathBuf),
#[error("native path is not valid Unicode: {0:?}")]
NonUnicode(PathBuf),
#[error("unsupported native path prefix: {0}")]
UnsupportedPrefix(PathBuf),
#[error("invalid VFS path: {0}")]
InvalidVfsPath(String),
}
impl From<FsPathError> for vfs::VfsError {
fn from(error: FsPathError) -> Self {
vfs::VfsError::from(vfs::error::VfsErrorKind::Other(error.to_string()))
}
}
fn validate_vfs_path(path: &str) -> Result<(), FsPathError> {
if path == "/" {
return Ok(());
}
let invalid = !path.starts_with('/')View on GitHub (pinned to bd85ce9dee)
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.
Example fix
// before let p = std::fs::canonicalize(r"C:\proj\main.baml")?; // \\?\C:\proj\main.baml // after let p = dunce::canonicalize(r"C:\proj\main.baml")?; // C:\proj\main.baml
Defensive patterns
Strategy: validation
Validate before calling
fn has_unsupported_prefix(p: &std::path::Path) -> bool {
let s = p.as_os_str().to_string_lossy();
s.starts_with("\\\\?\\") || s.starts_with("\\\\.\\")
}
// strip or reject before conversion Type guard
fn is_plain_windows_path(p: &std::path::Path) -> bool {
let s = p.as_os_str().to_string_lossy();
!s.starts_with("\\\\?\\") && !s.starts_with("\\\\.\\")
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- native path is not absolute: {0}
- Expected --from '{}' to be a baml_src/ directory, but it doe
- Expected --from '{}' to be a baml_src/ directory, but it is
- cannot determine directory of current executable
- `{}` doesn't look like it belongs to a BAML project — no `ba
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/70b8f61467783a78.
Report an issue: GitHub.