BoundaryML/baml · error
function `{name}` not found. use `baml run --list` to see av
Error message
function `{name}` not found.
use `baml run --list` to see available targets. What it means
The `baml run --function <name>` flag was given a function name that does not exist among the compiled program's user functions. The CLI builds a sorted candidate list of user function display names, matches against the given name by substring containment or a Jaro-Winkler similarity above 0.7, and throws this variant when no suggestion qualifies. It points the user at `baml run --list` to enumerate available targets.
Source
Thrown at baml_language/crates/baml_cli/src/run_command.rs:1344
let mut candidates: Vec<String> = engine
.user_functions()
.into_iter()
.map(|f| f.display_name)
.collect();
candidates.sort();
candidates.dedup();
let suggestions: Vec<&str> = candidates
.iter()
.filter(|c| {
c.contains(name) || name.contains(c.as_str()) || strsim::jaro_winkler(c, name) > 0.7
})
.take(5)
.map(String::as_str)
.collect();
if suggestions.is_empty() {
anyhow!(
"function `{name}` not found.\n\
use `baml run --list` to see available targets."
)
} else {
anyhow!(
"function `{name}` not found. Did you mean one of:\n{}",
suggestions
.iter()
.map(|s| format!(" - {s}"))
.collect::<Vec<_>>()
.join("\n")
)
}
}
fn target_not_found_error_in(
scripts: &HashMap<String, Vec<String>>,
engine: &BexEngine,View on GitHub (pinned to bd85ce9dee)
Solutions
- Run `baml run --list` to see the exact available function names.
- Fix the `--function` argument to the exact display name of an existing BAML function (names are case-sensitive).
- If targeting a script or namespace, pass it as a positional target instead of `--function` (e.g. `baml run <script>`).
- Verify you are in the correct project root so the intended .baml sources are compiled.
Example fix
// before baml run --function ExtractReusme // after baml run --function ExtractResume
Defensive patterns
Strategy: validation
Validate before calling
// shell: verify the function exists before invoking
baml run --list | grep -qx "$FUNC_NAME" || { echo "function $FUNC_NAME not found"; exit 1; } Try / catch
// capture stderr and fall back to --list if ! baml run --function "$FUNC" 2>err.log; then baml run --list exit 1 fi
Prevention
- Copy function names from `baml run --list` instead of typing them.
- Keep CI scripts in sync with function renames via grep/lint.
- Use positional targets for scripts/namespaces, `--function` only for functions.
When it happens
Trigger: Running `baml run --function <name>` where `<name>` is not a user function in the compiled BAML project (typo, removed/renamed function, wrong project directory, or a name that only matches scripts/namespaces which are not reachable via `--function`).
Common situations: Typos in function names; renaming or deleting a BAML function but running an old script alias or CI command; invoking a script or namespace name via `--function` instead of as a positional target; running in the wrong directory so the target project isn't compiled.
Related errors
- function `{name}` not found. Did you mean one of: {}
- no runnable target `{name}` found. use `baml run --list` to
- no runnable target `{name}` found. Did you mean one of: {}
- compilation failed: {e:?}
- function `{func}` not found. Use `baml run --list` to see av
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/c981b768eff17932.
Report an issue: GitHub.