BoundaryML/baml · error

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

Error message

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

What it means

The sibling of error 107 in resolve_one: when the requested function does not exist but similar user functions DO exist, the CLI bails with a not-found message plus a ranked list of suggestions (` - name` lines). Suggestions are ranked by substring containment first, then jaro-winkler similarity.

Source

Thrown at baml_language/crates/baml_cli/src/pack_command.rs:454

                    )
                });
        }
        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();
    let subcommand_name = display_name
        .rsplit('.')
        .next()
        .unwrap_or(&display_name)
        .to_string();

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Re-run with one of the suggested names from the `Did you mean one of:` list.
  2. Run `baml run --list` for the full set of valid targets.
  3. Use the fully qualified name if multiple modules define similar functions.

Example fix

// before
baml pack -f Gret
// error suggests: Greet

// after
baml pack -f Greet
Defensive patterns

Strategy: validation

Validate before calling

# exact-match against the list before invoking; accept the CLI's suggestion otherwise
baml run --list | grep -Fxq "$FUNC" || { echo "not found; check suggestions via baml pack -f output" >&2; exit 2; }

Try / catch

// accept the first "Did you mean" suggestion automatically
if let Err(e) = pack(func) {
    if let Some(sug) = parse_first_suggestion(&e.to_string()) {
        pack(&sug)?;
    } else { return Err(e); }
}

Prevention

When it happens

Trigger: Running `baml pack <TARGET>` or `baml pack -f <NAME>` with a misspelled or partially-typed function name that closely resembles existing functions.

Common situations: Typos like `Gret` for `Greet`; abbreviated names; casing mistakes (`greet` vs `Greet`); remembering an old name after a refactor.

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


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