BoundaryML/baml · error
no `.baml` files found in {}
Error message
no `.baml` files found in {} What it means
Raised during project loading when the project root (or --from directory) contains no *.baml source files. ProjectSession::open succeeded in finding a directory, but the glob for BAML sources came back empty — the sources may be in a subdirectory not searched, a wrong --from path was given, or the files use a different extension.
Source
Thrown at baml_language/crates/baml_cli/src/run_command.rs:842
}
/// Load the project (or standalone `--file`), check diagnostics,
/// compile to bytecode, create engine.
fn load_and_compile(&self, argv: Vec<String>, reporter: &Reporter) -> Result<Compiled> {
if let Some(file) = self.file.as_deref() {
return self.load_and_compile_standalone(file, argv, reporter);
}
let mut session = crate::project_session::ProjectSession::open(
self.from.as_deref(),
crate::project_session::CacheUse::ReadWrite,
)?;
self.vlog(format_args!(
"Loading project from {}",
session.root().display()
));
if session.is_empty() {
anyhow::bail!("no `.baml` files found in {}", session.root().display());
}
self.vlog(format_args!("Found {} .baml file(s)", session.file_count()));
let needs_format_hint = session.needs_format_hint();
if let Some(program) = session.try_cached_program() {
self.vlog(format_args!("Bytecode cache hit — skipping compile"));
match BexEngine::new_with_runtime_compiler(
program,
Arc::new(sys_native::SysOps::native()),
argv.clone(),
bex_project::runtime_compiler(),
) {
Ok(engine) => {
return Ok(Compiled {
db: session.db,
package: session.package,
engine,
needs_format_hint,View on GitHub (pinned to bd85ce9dee)
Solutions
- Run from the directory containing `baml_src/` with `.baml` files, or pass the correct project path
- Verify `.baml` files exist under the project root shown in the error
- Check the project root configuration in `baml.toml`
Example fix
# before (wrong dir) cd ./empty_dir && baml run -f MyFn # after cd ./my_project && baml run -f MyFn
Defensive patterns
Strategy: validation
Validate before calling
const { globSync } = require('glob'); if (globSync('**/*.baml', { cwd: projectRoot }).length === 0) throw new Error(`no .baml files in ${projectRoot}`); Prevention
- Run baml run from a directory containing .baml sources
- Verify project root / baml.toml location before invoking
- Keep .baml extension intact when renaming files
When it happens
Trigger: `load_and_compile` finds `session.is_empty()` after loading the project directory — no files matching `*.baml` exist under the resolved project root.
Common situations: Running `baml run` outside a BAML project or in an empty directory; misconfigured project root in `baml.toml`; all `.baml` files moved/deleted or renamed with a wrong extension.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- no `.baml` files found in {}
- toolchain binary not found: {}{origin}
- BAML toolchain {version} is not installed
- compilation failed: {e:?}
- could not find packaged playground assets. For local debuggi
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/edc826befc87b1e8.
Report an issue: GitHub.