{"record":{"id":"46477c98957f9391","repo":"BoundaryML/baml","slug":"expected-from-to-be-a-baml-src-directory-but-it-does-not","errorCode":null,"errorMessage":"Expected --from '{}' to be a baml_src/ directory, but it does not exist","messagePattern":"Expected --from '(.+?)' to be a baml_src/ directory, but it does not exist","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/lib.rs","lineNumber":544,"sourceCode":"            db,\n            diagnostics,\n            clients: Default::default(),\n            retry_policies: Default::default(),\n            source_files,\n            tracer_wrapper: Arc::new(BamlTracerWrapper::new(env_vars)?),\n            #[cfg(not(target_arch = \"wasm32\"))]\n            async_runtime: rt.clone(),\n            publisher_env_vars: Some(publisher_env_vars),\n        };\n\n        Ok(runtime)\n    }\n\n    pub fn parse_baml_src_path(path: impl Into<PathBuf>) -> Result<PathBuf> {\n        let mut path: PathBuf = path.into();\n\n        if !path.exists() {\n            anyhow::bail!(\n                \"Expected --from '{}' to be a baml_src/ directory, but it does not exist\",\n                path.display()\n            );\n        }\n\n        if !path.is_dir() {\n            anyhow::bail!(\n                \"Expected --from '{}' to be a baml_src/ directory, but it is not\",\n                path.display()\n            );\n        }\n\n        if path.file_name() != Some(std::ffi::OsStr::new(\"baml_src\")) {\n            let contained = path.join(\"baml_src\");\n\n            if contained.exists() && contained.is_dir() {\n                path = contained;\n            } else {","sourceCodeStart":526,"sourceCodeEnd":562,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/lib.rs#L526-L562","documentation":"parse_baml_src_path validates the --from path before locating the BAML source directory. It fails immediately when the given path does not exist on disk, so the CLI/runtime cannot locate a baml_src directory from it.","triggerScenarios":"Calling BamlRuntime::from_directory/parse_baml_src_path (or the CLI's --from flag) with a path that doesn't exist: typo'd path, wrong working directory, deleted or never-created baml_src folder.","commonSituations":"Running baml CLI from a different directory than the project root, renaming the baml_src folder, Docker images missing the source directory, CI checking out a partial repo.","solutions":["Verify the path exists with ls/ls -la and correct any typo","Run the command from the project root or pass an absolute path via --from","Ensure baml_src/ is committed/present in container or CI images","Confirm the correct folder name is baml_src (not baml-src or src)"],"exampleFix":"// before\nBamlRuntime::from_directory(\"./baml_srcs\")?;\n// after\nBamlRuntime::from_directory(\"./baml_src\")?; // path must exist and be baml_src","handlingStrategy":"validation","validationCode":"use std::path::Path;\nfn validate_from(p: &str) -> Result<(), String> {\n    let path = Path::new(p);\n    if !path.exists() {\n        return Err(format!(\"--from '{}' does not exist\", p));\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check path existence before invoking the CLI/runtime","Use absolute paths in scripts and CI","Ensure baml_src/ is present in Docker/CI artifacts"],"tags":["rust","cli","filesystem","path"],"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-14T05:17:10.506Z"}