{"record":{"id":"749d312490bbe2dc","repo":"wasmerio/wasmer","slug":"invalid-guest-mount-path-platform-specific-p","errorCode":null,"errorMessage":"Invalid guest mount path \"{}\": platform-specific prefixes are not supported","messagePattern":"Invalid guest mount path \"(.+?)\": platform-specific prefixes are not supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/wasix/src/runners/wasi_common.rs","lineNumber":215,"sourceCode":"    }\n\n    let mut normalized = PathBuf::from(\"/\");\n    for component in guest_path.components() {\n        match component {\n            Component::RootDir => normalized = PathBuf::from(\"/\"),\n            Component::CurDir => {}\n            Component::ParentDir => {\n                if normalized.as_os_str() == \"/\" {\n                    anyhow::bail!(\n                        \"Invalid guest mount path \\\"{}\\\": parent traversal escapes the virtual root\",\n                        guest_path.display()\n                    );\n                }\n                normalized.pop();\n            }\n            Component::Normal(part) => normalized.push(part),\n            Component::Prefix(_) => {\n                anyhow::bail!(\n                    \"Invalid guest mount path \\\"{}\\\": platform-specific prefixes are not supported\",\n                    guest_path.display()\n                );\n            }\n        }\n    }\n\n    Ok(normalized)\n}\n\nfn prepare_filesystem(\n    base_root: Arc<dyn FileSystem + Send + Sync>,\n    memory_limiter: Option<&DynFsMemoryLimiter>,\n    mounted_dirs: &[MountedDirectory],\n    container_mounts: Option<&BinaryPackageMounts>,\n    conflict_behavior: ExistingMountConflictBehavior,\n) -> Result<WasiFsRoot, Error> {\n    let mut root_layers: Vec<Arc<dyn FileSystem + Send + Sync>> = Vec::new();","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/wasix/src/runners/wasi_common.rs#L197-L233","documentation":"normalized_mount_path rejects guest mount paths that contain a Component::Prefix (platform-specific prefixes such as Windows drive letters 'C:\\' or UNC '\\\\server\\share'). Such prefixes have no meaning inside the guest's POSIX-like virtual root, so the mount is refused rather than silently misinterpreted.","triggerScenarios":"Calling prepare_filesystem with a Windows-style absolute guest path like 'C:\\\\data', 'D:\\\\', or a UNC path '\\\\\\\\server\\\\share' as the GUEST side of a mount mapping (typically when running/building on Windows and passing the host path into the guest slot by mistake).","commonSituations":"Users on Windows copying their host path into both sides of a --mapdir/mount config; config files authored on Windows then used cross-platform; programmatic PathBuf::from(\"C:\\\\...\") passed as guest path.","solutions":["Use a rooted POSIX-style guest path (start with '/') for the guest side, e.g. '/data' instead of 'C:\\\\data'","Put the Windows drive/UNC path only in the HOST portion of the mount mapping","If building both sides from one string, split on the mount separator and convert the guest side with Path::new(guest).components() filtering or by hardcoding a rooted virtual path","On Windows hosts, disable path-prefix auto-detection by constructing the guest path explicitly from '/' + components rather than reusing the host PathBuf"],"exampleFix":"// before\nlet guest = PathBuf::from(\"C:\\\\data\"); // Prefix component\nrunner.with_mount(guest, host_dir)?;\n// after\nlet guest = PathBuf::from(\"/data\");\nrunner.with_mount(guest, host_dir)?; // host_dir may be C:\\data","handlingStrategy":"validation","validationCode":"fn validate_no_prefix(guest: &std::path::Path) -> Result<(), String> {\n    use std::path::Component;\n    for c in guest.components() {\n        if let Component::Prefix(_) = c {\n            return Err(format!(\n                \"guest mount path must be POSIX-style, got: {}\",\n                guest.display()\n            ));\n        }\n    }\n    Ok(())\n}\nvalidate_no_prefix(std::path::Path::new(\"/data\"))?;","typeGuard":"fn is_posix_style_guest_path(p: &std::path::Path) -> bool {\n    use std::path::Component;\n    p.components()\n        .all(|c| !matches!(c, Component::Prefix(_)))\n}","tryCatchPattern":null,"preventionTips":["On Windows hosts, never reuse a host PathBuf for the guest side of a mount; build the guest path from a '/' root explicitly","Keep host (drive-letter/UNC) and guest (POSIX) paths in clearly separated config fields","Test mount configs on a Linux CI job to catch Windows-only prefix paths early","Strip drive letters programmatically if converting host paths into guest paths, then re-root at '/'"],"tags":["wasix","mount","path-validation","windows","wasi"],"backgroundTag":"unsupported-path-prefix","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}