BoundaryML/baml · error
function `{func}` not found. Use `baml run --list` to see av
Error message
function `{func}` not found. Use `baml run --list` to see available targets. What it means
resolve_one looks a requested function name up against the loaded engine (engine.function_exists). When the name does not exist AND no similar names can be suggested (function_suggestions returned empty), the CLI bails with a plain not-found message pointing at `baml run --list`. This is the no-suggestion variant of the unknown-function error.
Source
Thrown at baml_language/crates/baml_cli/src/pack_command.rs:449
.map(str::to_string)
.ok_or_else(|| {
anyhow::anyhow!(
"cannot derive an output name from `{}`; pass `-o <PATH>` to name the output.",
file.display()
)
});
}
crate::project_load::resolve_project_name(self.from.as_deref())
}
}
/// Resolve a single function-name string against the engine; returns
/// canonical qualified/display/subcommand-name triple.
fn resolve_one(engine: &BexEngine, func: &str) -> Result<ResolvedPackTarget> {
if !engine.function_exists(func) {
let suggestions = function_suggestions(engine, func);
if suggestions.is_empty() {
anyhow::bail!(
"function `{func}` not found. Use `baml run --list` to see \
available targets."
);
}
anyhow::bail!(
"function `{func}` not found. Did you mean one of:\n{}",
suggestions
.iter()
.map(|s| format!(" - {s}"))
.collect::<Vec<_>>()
.join("\n")
);
}
let qualified_name = canonicalize_function_name(engine, func);
let display_name = qualified_name
.strip_prefix("user.")
.unwrap_or(&qualified_name)
.to_string();View on GitHub (pinned to bd85ce9dee)
Solutions
- Run `baml run --list` to see the available target names and use one verbatim.
- Check spelling/casing, including the full qualified name (e.g. `module.Function`).
- Verify you're in (or passing `--from`) the project that actually defines the function.
Example fix
// before baml pack -f MyFunciton // after (check real name first) baml run --list baml pack -f MyFunction
Defensive patterns
Strategy: validation
Validate before calling
# verify the function exists before packing
baml run --list | grep -Fxq "$FUNC" || { echo "unknown function: $FUNC" >&2; exit 2; } Prevention
- Look up exact names with `baml run --list` instead of typing from memory.
- Use fully qualified names when multiple modules define functions.
- Update scripts after renaming or deleting functions.
When it happens
Trigger: Running `baml pack <TARGET>` or `baml pack -f <NAME>` where the name matches no function in the project and is not similar to any existing one (so the suggestion list is empty).
Common situations: Typos with no close match; targeting a function defined in another project or branch; the function was deleted or renamed; running from a directory whose project doesn't include the function.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- function `{func}` not found. Did you mean one of: {}
- positional `<TARGET>` and `-f/--function` are mutually exclu
- no target specified. Pass a positional `<TARGET>` to pack on
- compilation failed: {e:?}
- no `.baml` files found in {}
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/dea7e872e733a66c.
Report an issue: GitHub.