{"record":{"id":"c33a356c1759eb36","repo":"unicity-aos/aos-ce","slug":"variable-cannot-contain-a-platform-path-separator","errorCode":null,"errorMessage":"{variable} cannot contain a platform PATH separator","messagePattern":"(.+?) cannot contain a platform PATH separator","errorType":"validation","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"crates/unicity-aos-bootstrap/src/lib.rs","lineNumber":581,"sourceCode":"            format!(\n                \"AOS managed path must be a real directory: {}\",\n                path.display()\n            ),\n        ));\n    }\n    #[cfg(unix)]\n    {\n        use std::os::unix::fs::PermissionsExt;\n        fs::set_permissions(path, fs::Permissions::from_mode(0o700))?;\n    }\n    Ok(())\n}\n\nfn validate_path_entry(path: &Path, variable: &str) -> io::Result<()> {\n    std::env::join_paths(std::iter::once(path))\n        .map(drop)\n        .map_err(|_| {\n            io::Error::new(\n                io::ErrorKind::InvalidInput,\n                format!(\"{variable} cannot contain a platform PATH separator\"),\n            )\n        })\n}\n\nfn set_private_file_permissions(path: &Path) -> io::Result<()> {\n    #[cfg(unix)]\n    {\n        use std::os::unix::fs::PermissionsExt;\n        fs::set_permissions(path, fs::Permissions::from_mode(0o600))?;\n    }\n    #[cfg(not(unix))]\n    let _ = path;\n    Ok(())\n}\n\n#[cfg(windows)]","sourceCodeStart":563,"sourceCodeEnd":599,"githubUrl":"https://github.com/unicity-aos/aos-ce/blob/f6f22024fb1e8d122f28a1b4a9f75aee448ae839/crates/unicity-aos-bootstrap/src/lib.rs#L563-L599","documentation":"validate_path_entry wraps std::env::join_paths, which fails when a single path entry contains the platform's PATH separator (':' on Unix, ';' on Windows); the library converts that failure into this io::Error (InvalidInput). Since the value will be placed into a PATH-like environment variable, an embedded separator would be silently split into multiple bogus entries, so it is rejected up front.","triggerScenarios":"Calling validated_environment_root (which validates each candidate path via validate_path_entry) when the env variable's value (e.g. AOS_HOME or similar) contains ':' or ';' — typically because a Windows-style 'C:\\...' string was pasted into a Unix environment, or a list of paths was assigned to a variable that expects exactly one path.","commonSituations":"Setting AOS_HOME='C:\\Users\\me\\aos' on Linux/macOS; quoting or copying a PATH-style value into a single-value variable; Windows/Unix environment drift in WSL or CI where PATH-formatted values are reused.","solutions":["Remove the platform PATH separator from the variable's value: it must be exactly one path.","On Windows code paths, use a Windows path (drive letter + backslashes); on Unix, avoid pasted Windows paths with drive letters or semicolons.","If you need multiple locations, use the variable intended for a list of paths instead of a single-path variable.","Echo the variable and check for ':' (Unix) or ';' (Windows) before launching."],"exampleFix":"// before\nexport AOS_HOME=\"/opt/aos:/opt/aos2\"\n// after\nexport AOS_HOME=\"/opt/aos\"","handlingStrategy":"validation","validationCode":"fn valid_single_path_entry(v: &str) -> bool {\n    let sep = if cfg!(windows) { ';' } else { ':' };\n    !v.is_empty() && !v.contains(sep)\n}\nif !valid_single_path_entry(&value) {\n    return Err(\"the variable must contain exactly one path with no PATH separator\");\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.kind() == std::io::ErrorKind::InvalidInput && e.to_string().contains(\"PATH separator\") => {\n        eprintln!(\"fix the environment variable: it must be a single path without ':' or ';'\");\n    }\n    other => other?,\n}","preventionTips":["Assign exactly one path to single-path env variables; never copy a PATH-style list into them.","Watch for Windows paths (drive letters, backslashes, semicolons) pasted into Unix/WSL environments and vice versa.","Validate the variable value in wrapper scripts before launching the process."],"tags":["environment","path","validation","rust"],"backgroundTag":"invalid-env-var-value","analyzedSha":"f6f22024fb1e8d122f28a1b4a9f75aee448ae839","analyzedAt":"2026-09-13T03:04:44.565Z","contentChangedAt":"2026-09-13T03:04:44.565Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}