BoundaryML/baml · error
no `.baml` files found in {}
Error message
no `.baml` files found in {} What it means
The BAML CLI playground launcher (workspace_roots in playground_command.rs) loads the detected project and requires at least one `.baml` source file at the project root. If the resolved project directory contains no `.baml` files, it bails with this message naming the root path. This guards the playground from serving an empty project with nothing to render or compile.
Source
Thrown at baml_language/crates/baml_cli/src/playground_command.rs:124
return match resolve_source_location(from, file, None)? {
SourceLocation::StandaloneFile { file, .. } => Ok(vec![file]),
SourceLocation::Project { .. } => unreachable!("file mode resolved as a project"),
};
}
let search_start = resolve_project_search_start(from)
.with_context(|| "could not resolve playground project search path")?;
let Some(marked_root) = find_baml_project_root(&search_start) else {
anyhow::bail!(
"`{}` doesn't look like it belongs to a BAML project — no `baml.toml` \
and no `baml_src/` directory found in it or its ancestors.",
search_start.display()
);
};
let project = load_project_from(Some(&marked_root))?;
let root = project.root().to_path_buf();
if project.files.is_empty() {
anyhow::bail!("no `.baml` files found in {}", root.display());
}
Ok(vec![root])
}
fn resolve_playground_assets() -> Result<Option<PathBuf>> {
if std::env::var_os("BAML_PLAYGROUND_DEV_PORT").is_some()
|| std::env::var_os("BAML_PLAYGROUND_DIR").is_some()
{
return Ok(None);
}
if let Some(dir) = discover_playground_dir()? {
return Ok(Some(dir));
}
anyhow::bail!(
"could not find packaged playground assets. For local debugging, run \
`pnpm --filter app-vscode-webview dev -- --host 127.0.0.1 --port 4000` \View on GitHub (pinned to bd85ce9dee)
Solutions
- Add at least one `.baml` file to the project root (or its baml_src directory).
- Check the path printed in the error — that directory is where files must live; move your `.baml` files there.
- If the project marker points at the wrong root, remove/relocate the stray baml_src directory or manifest.
- Restore deleted or ignored `.baml` files (check .gitignore).
Example fix
// before: baml_src/ exists but is empty mkdir baml_src && baml playground // fails // after: put sources in baml_src mv *.baml baml_src/ baml playground
Defensive patterns
Strategy: validation
Validate before calling
# before running `baml playground`
shopt -s nullglob
files=(baml_src/*.baml)
if [ ${#files[@]} -eq 0 ]; then echo "No .baml files in baml_src/"; exit 1; fi Prevention
- Keep all BAML sources inside baml_src/ and never rename them to other extensions.
- Run `baml validate` or list files in baml_src before launching the playground.
- Ensure .gitignore does not exclude .baml files.
When it happens
Trigger: Running `baml playground` (or its callers like project-mode validation tests) in a directory that has a project marker (baml_src/ or manifest) but zero `.baml` files: `project.files.is_empty()` after `load_project_from(Some(&marked_root))`.
Common situations: A baml_src folder was created (e.g. `baml init` partially failed or files were moved/deleted); the `.baml` files live in a subdirectory outside the marked root; a rename from `.baml` to another extension; a fresh repo cloned without generated sources.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- could not find packaged playground assets. For local debuggi
- no `.baml` files found in {}
- compilation failed: {e:?}
- `{}` doesn't look like it belongs to a BAML project — no `ba
- `--file` and `--project` are mutually exclusive; `--file` al
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/42d9e4e935edefba.
Report an issue: GitHub.