{"record":{"id":"6e1b90965daf43c1","repo":"BoundaryML/baml","slug":"platform-not-supported-os-arch","errorCode":null,"errorMessage":"Platform not supported: {os}/{arch}","messagePattern":"Platform not supported: (.+?)/(.+?)","errorType":"exception","errorClass":"BamlSysError","httpStatus":null,"severity":"error","filePath":"languages/rust/baml-sys/src/error.rs","lineNumber":34,"sourceCode":"        path: PathBuf,\n        #[source]\n        source: libloading::Error,\n    },\n\n    /// Symbol not found in loaded library.\n    #[error(\"Symbol '{symbol}' not found in BAML library: {source}\")]\n    SymbolNotFound {\n        symbol: &'static str,\n        #[source]\n        source: libloading::Error,\n    },\n\n    /// Version mismatch between Rust package and loaded library.\n    #[error(\"Version mismatch: Rust package expects {expected}, but library reports {actual}\")]\n    VersionMismatch { expected: String, actual: String },\n\n    /// Platform not supported.\n    #[error(\"Platform not supported: {os}/{arch}\")]\n    UnsupportedPlatform {\n        os: &'static str,\n        arch: &'static str,\n    },\n\n    /// Failed to determine cache directory.\n    #[error(\"Failed to determine cache directory: {0}\")]\n    CacheDir(String),\n\n    /// Download failed.\n    #[error(\"Failed to download library: {0}\")]\n    DownloadFailed(String),\n\n    /// Checksum mismatch after download.\n    #[error(\"Checksum mismatch: expected {expected}, got {actual}\")]\n    ChecksumMismatch { expected: String, actual: String },\n\n    /// IO error.","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/languages/rust/baml-sys/src/error.rs#L16-L52","documentation":"`BamlSysError::UnsupportedPlatform` from baml-sys: the loader was asked to find/load a BAML library on an OS/architecture combination it has no prebuilt artifact or mapping for. The message names the offending `os`/`arch`.","triggerScenarios":"Running on an unsupported target (e.g. freebsd, solaris, or niche arch like mips/riscv) where baml-sys has no library filename mapping or no published prebuilt library.","commonSituations":"Building/running in unusual containers or emulators; cross-compiling to a non-tier-1 target; using a musl/embedded target with no prebuilt native lib.","solutions":["Run on a supported platform (e.g. linux/darwin/windows on x86_64 or aarch64)","Build the native BAML library from source for your platform and supply it via the search paths","Contribute/add a platform mapping and prebuilt artifact for the target"],"exampleFix":"// before\n# running on freebsd/x86 -> UnsupportedPlatform: freebsd/x86\n// after\n# run under supported linux-x86_64 container: docker run --platform linux/amd64 ...","handlingStrategy":"validation","validationCode":"let (os, arch) = (std::env::consts::OS, std::env::consts::ARCH);\nconst SUPPORTED: &[(&str, &str)] = &[(\"linux\",\"x86_64\"),(\"linux\",\"aarch64\"),(\"macos\",\"x86_64\"),(\"macos\",\"aarch64\"),(\"windows\",\"x86_64\")];\nif !SUPPORTED.contains(&(os, arch)) { eprintln!(\"Unsupported platform {os}/{arch}\"); }","typeGuard":"fn is_supported_platform() -> bool {\n    matches!((std::env::consts::OS, std::env::consts::ARCH),\n        (\"linux\", \"x86_64\") | (\"linux\", \"aarch64\") | (\"macos\", \"aarch64\") | (\"macos\", \"x86_64\") | (\"windows\", \"x86_64\"))\n}","tryCatchPattern":"match load_baml_sys() {\n    Err(BamlSysError::UnsupportedPlatform { os, arch }) => {\n        eprintln!(\"No prebuilt BAML library for {os}/{arch}; build from source or switch platform\");\n    }\n    Ok(sys) => { /* use sys */ }\n}","preventionTips":["Check supported platform matrix before deploying","Add a startup platform check with a clear failure message","Provide source-build fallbacks for niche targets","Set explicit --platform in Docker builds"],"tags":["rust","ffi","platform","compatibility"],"backgroundTag":"unsupported-platform","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}