BoundaryML/baml · error

function `{name}` not found. Did you mean one of: {}

Error message

function `{name}` not found. Did you mean one of:
{}

What it means

The did-you-mean variant of the `--function` not-found error: `baml run --function <name>` was given a name that matches no user function, but the CLI found up to 5 close candidates (substring match either way, or Jaro-Winkler similarity > 0.7) among the compiled program's user functions. The error lists those suggestions; scripts and namespaces are deliberately excluded because they aren't reachable via `--function`.

Source

Thrown at baml_language/crates/baml_cli/src/run_command.rs:1349

        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,
        name: &str,
        cwd: &Path,
    ) -> anyhow::Error {
        let namespaces = collect_namespaces(engine);
        struct Candidate {

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Re-run with one of the suggested names listed in the error (e.g. `baml run --function <suggested>`).
  2. Copy the exact function name from `baml run --list` output.
  3. If the intended function was renamed, update the calling script/CI config to the new name.
  4. Confirm you are in the right project so the intended function is compiled.

Example fix

// before
baml run --function classifySentament
// after
baml run --function classifySentiment
Defensive patterns

Strategy: validation

Validate before calling

// shell: exact-match check before running
baml run --list | grep -qx "$FUNC_NAME" || { echo "typo? check list below"; baml run --list; exit 1; }

Try / catch

// parse the 'Did you mean' suggestions from stderr
out=$(baml run --function "$FUNC" 2>&1) || { echo "$out"; exit 1; }

Prevention

When it happens

Trigger: Running `baml run --function <name>` where `<name>` is a near-miss of an actual user function name — close enough to trigger the suggestion heuristic but not an exact match (e.g. different casing, plural/singular, truncated name).

Common situations: Typos and casing mistakes (camelCase vs snake_case); an older name kept in muscle memory after a rename; autocomplete truncation in shell history; referencing a function that exists in another version of the codebase.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/d8421621bf1cd41d. Report an issue: GitHub.