BoundaryML/baml · error
{} `{}` not found.
Error message
{} `{}` not found. What it means
This is the zero-suggestions arm of the error_not_found! macro: a named entity (class, enum, function, etc.) was looked up in the IR and not found, and no near-match candidates existed to suggest. The error states 'TYPE `NAME` not found.' with no 'did you mean' hint.
Source
Thrown at engine/baml-lib/baml-core/src/ir/ir_helpers/error_utils.rs:59
let filtered_names = name_distances
.iter()
.filter(|&&(dist, _)| dist <= THRESHOLD)
.map(|&(_, idx)| options.index(idx).as_ref());
// Return either a limited or full set of filtered names
match max_return {
Some(max) => filtered_names.take(max).collect(),
None => filtered_names.collect(),
}
}
#[macro_export]
macro_rules! error_not_found {
($type:expr, $name:expr, $candidates:expr) => {{
let suggestions =
$crate::ir::ir_helpers::error_utils::sort_by_match($name, $candidates, Some(5));
match suggestions.len() {
0 => anyhow::bail!("{} `{}` not found.", $type, $name),
1 => {
anyhow::bail!(
"{} `{}` not found. Did you mean: {}?",
$type,
$name,
suggestions[0]
)
}
_ => {
let suggestions = suggestions.join(", ");
anyhow::bail!(
"{} `{}` not found. Did you mean one of: {}?",
$type,
$name,
suggestions
)
}
}View on GitHub (pinned to bd85ce9dee)
Solutions
- Define the missing entity in a .baml file
- Fix the name to exactly match an existing definition (names are case-sensitive)
- Check that the file defining the entity is in the baml_src directory
- Run a listing of available classes/enums/functions to pick the right name
Example fix
// before
function A() -> UserProfil
// after
class UserProfile { id int }
function A() -> UserProfile Defensive patterns
Strategy: validation
Validate before calling
// verify the symbol exists before referencing it
// baml CLI: list available definitions
// bazel-like check in Rust caller:
if ir.find_class(name).is_err() && ir.find_enum(name).is_err() {
eprintln!("{} is not defined in any .baml file", name);
} Type guard
fn symbol_exists(name: &str, ir: &Ir) -> bool {
ir.find_class(name).is_ok() || ir.find_enum(name).is_ok() || ir.find_function(name).is_ok()
} Try / catch
match result {
Err(e) if e.to_string().contains("not found.") => {
// no suggestions: name is completely unknown, fix definition or spelling
Err(e)
}
other => other,
} Prevention
- Copy symbol names from definitions, not from memory
- Keep one canonical .baml source directory
- Use editor BAML extension for autocomplete
When it happens
Trigger: Invoking error_not_found!("class", "Foo", candidates) from IR resolution when 'Foo' matches no definition and no candidate passes the similarity cutoff in sort_by_match.
Common situations: Completely mistyped type/function names in .baml; referencing a type after deleting its definition; working in a repo where the .baml defining the symbol was never committed.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- Item: {} not found
- {} `{}` not found. Did you mean: {}?
- {} `{}` not found. Did you mean one of: {}?
- function `{function_name}` not found
- function `{target_name}` not found
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/016436daae767a97.
Report an issue: GitHub.