{"record":{"id":"9aa4a670a0b3a2f1","repo":"BoundaryML/baml","slug":"baml-library-not-found-searched-paths-searched-paths","errorCode":null,"errorMessage":"BAML library not found. Searched paths: {searched_paths:?}","messagePattern":"BAML library not found\\. Searched paths: (.+?)","errorType":"exception","errorClass":"BamlSysError","httpStatus":null,"severity":"critical","filePath":"languages/rust/baml-sys/src/error.rs","lineNumber":10,"sourceCode":"//! Error types for baml-sys library loading.\n\nuse std::path::PathBuf;\n\n/// Errors that can occur during library loading.\n#[derive(Debug, thiserror::Error)]\n#[allow(missing_docs)] // Error variants are self-documenting via #[error(...)]\npub enum BamlSysError {\n    /// Library file not found at any search path.\n    #[error(\"BAML library not found. Searched paths: {searched_paths:?}\")]\n    LibraryNotFound { searched_paths: Vec<PathBuf> },\n\n    /// Failed to load the dynamic library.\n    #[error(\"Failed to load BAML library from {path}: {source}\")]\n    LoadFailed {\n        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","sourceCodeStart":1,"sourceCodeEnd":28,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/languages/rust/baml-sys/src/error.rs#L1-L28","documentation":"`BamlSysError::LibraryNotFound` from baml-sys, reported via thiserror. The native BAML dynamic library (`.so`/`.dylib`/`.dll`) could not be located at any of the configured search paths at load time. The message lists every path that was searched so you can see what was tried.","triggerScenarios":"Initializing/loading the BAML library through baml-sys before the native library has been built or installed, or when search paths point to the wrong directories.","commonSituations":"Fresh clone without building the native lib; library installed to a nonstandard location not on the search path; wrong package variant for your platform; CI images missing the native artifact.","solutions":["Build or install the native BAML library and place it in one of the listed search paths","Fix the library search path configuration / env (e.g. point loader at the actual .so/.dylib/.dll location)","Install the correct platform-specific package variant matching your OS/arch"],"exampleFix":"// before\nlet sys = BamlSys::new(&[\"/opt/nonexistent/lib\"])?; // LibraryNotFound\n// after\nlet sys = BamlSys::new(&[\"/opt/nonexistent/lib\", \"/usr/local/lib\"])?;\n// ensure libbaml.so exists: cp target/release/libbaml.so /usr/local/lib/","handlingStrategy":"validation","validationCode":"let paths = candidate_paths();\nlet missing: Vec<_> = paths.iter().filter(|p| !p.exists()).collect();\nif missing.len() == paths.len() { return Err(\"BAML native library not installed\"); }","typeGuard":"fn library_present(path: &std::path::Path) -> bool { path.is_file() }","tryCatchPattern":"match load_baml_sys() {\n    Err(BamlSysError::LibraryNotFound { searched_paths }) => {\n        eprintln!(\"Build/install the native lib; searched: {searched_paths:?}\");\n    }\n    Ok(sys) => { /* use sys */ }\n}","preventionTips":["Build the native library as part of your build/install script","Verify library presence at startup with a fail-fast check","Keep search paths configurable via env/config","Install the platform-matching package variant in CI images"],"tags":["rust","ffi","library-loading","dynamic-linking"],"backgroundTag":"file-not-found","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"}