BoundaryML/baml · error · BamlSysError
Platform not supported
Error message
Platform not supported: {os}/{arch} What it means
`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`.
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
Example fix
// before # running on freebsd/x86 -> UnsupportedPlatform: freebsd/x86 // after # run under supported linux-x86_64 container: docker run --platform linux/amd64 ...
Defensive patterns
Strategy: validation
Validate before calling
let (os, arch) = (std::env::consts::OS, std::env::consts::ARCH);
const SUPPORTED: &[(&str, &str)] = &[("linux","x86_64"),("linux","aarch64"),("macos","x86_64"),("macos","aarch64"),("windows","x86_64")];
if !SUPPORTED.contains(&(os, arch)) { eprintln!("Unsupported platform {os}/{arch}"); } Type guard
fn is_supported_platform() -> bool {
matches!((std::env::consts::OS, std::env::consts::ARCH),
("linux", "x86_64") | ("linux", "aarch64") | ("macos", "aarch64") | ("macos", "x86_64") | ("windows", "x86_64"))
} Try / catch
match load_baml_sys() {
Err(BamlSysError::UnsupportedPlatform { os, arch }) => {
eprintln!("No prebuilt BAML library for {os}/{arch}; build from source or switch platform");
}
Ok(sys) => { /* use sys */ }
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- {0}
- BAML library not found. Searched paths
- Engine not initialized. Call create_baml_runtime first.
- Expected Collector, got
- Expected string value for tag key
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/6e1b90965daf43c1.
Report an issue: GitHub.
Appendix: source
Thrown at languages/rust/baml-sys/src/error.rs:34
path: PathBuf,
#[source]
source: libloading::Error,
},
/// Symbol not found in loaded library.
#[error("Symbol '{symbol}' not found in BAML library: {source}")]
SymbolNotFound {
symbol: &'static str,
#[source]
source: libloading::Error,
},
/// Version mismatch between Rust package and loaded library.
#[error("Version mismatch: Rust package expects {expected}, but library reports {actual}")]
VersionMismatch { expected: String, actual: String },
/// Platform not supported.
#[error("Platform not supported: {os}/{arch}")]
UnsupportedPlatform {
os: &'static str,
arch: &'static str,
},
/// Failed to determine cache directory.
#[error("Failed to determine cache directory: {0}")]
CacheDir(String),
/// Download failed.
#[error("Failed to download library: {0}")]
DownloadFailed(String),
/// Checksum mismatch after download.
#[error("Checksum mismatch: expected {expected}, got {actual}")]
ChecksumMismatch { expected: String, actual: String },
/// IO error.View on GitHub (pinned to bd85ce9dee)