BoundaryML/baml · error

LLM Function not found

Error message

LLM Function {} not found

What it means

When the REPL evaluates a function-call expression, it looks up the function's parameter names in the runtime's function table; if the name is absent the call is rejected with this error. The runtime has no LLM function registered under that identifier.

Solutions

  1. Check the exact function name spelling against your .baml files
  2. Run :load <path-to-baml_src> to (re)load sources containing the function
  3. Use :functions (or :help) to list functions the runtime currently knows
  4. Verify the loaded directory is the correct baml_src folder

Example fix

// before (REPL input)
:MyFucn(1)
// after
:load ./baml_src
MyFunc(1)
Defensive patterns

Strategy: validation

Validate before calling

// Before calling, confirm the function exists in loaded sources
// grep the loaded baml_src: grep -r "function MyFunc" baml_src/
// At the REPL, check available functions first (see :help)

Try / catch

match result { Err(e) if e.to_string().contains("not found") => eprintln!("Load sources first: :load ./baml_src ({e})"), other => { let _ = other; } }

Prevention

When it happens

Trigger: Evaluating FunctionName(args) at the REPL when fn_params has no entry for that name — i.e. the function is not defined in the loaded BAML sources or was not reloaded after defining it.

Common situations: Typos in the function name, calling a function defined in a .baml file that was edited but not :load-reloaded, calling a function from a project whose baml_src was never loaded.

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


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

Appendix: source

Thrown at engine/baml-runtime/src/cli/repl.rs:547

        let run_id = self.current_run_id.unwrap_or(0);
        let handle_llm_function = move |function_name: String,
                                        args: Vec<BamlValue>,
                                        _watch_context: Option<
            baml_compiler::thir::interpret::WatchStreamContext,
        >| {
            let fn_params = fn_params.clone();
            let runtime_clone = runtime_clone.clone();
            let env_vars = env_vars.clone();
            let status_tx = status_tx.clone();
            async move {
                match runtime_clone.as_ref() {
                    Some(runtime) => {
                        if let Some(tx) = &status_tx {
                            let _ = tx.send(LlmStatusEvent::Started(run_id, function_name.clone()));
                        }
                        let param_names = fn_params
                            .get(&function_name)
                            .ok_or_else(|| anyhow!("LLM Function {} not found", function_name))?;
                        let args = args
                            .clone()
                            .into_iter()
                            .zip(param_names.iter())
                            .map(|(arg, name)| (name.clone(), arg.clone()))
                            .collect();
                        let cxt =
                            runtime.create_ctx_manager(BamlValue::String("none".to_string()), None);
                        let status_tx2 = status_tx.clone();
                        let res = runtime
                            .call_function(
                                function_name,
                                &args,
                                &cxt,
                                None,
                                None,
                                None,
                                env_vars,

View on GitHub (pinned to bd85ce9dee)