{"record":{"id":"d562e5eb0eb1f01d","repo":"BoundaryML/baml","slug":"function-function-name-not-found-async-vm-runtime","errorCode":null,"errorMessage":"function '{function_name}' not found","messagePattern":"function '(.+?)' not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/async_vm_runtime.rs","lineNumber":179,"sourceCode":"        &self,\n        function_name: String,\n        params: &BamlMap<String, BamlValue>,\n        ctx: &RuntimeContextManager,\n        tb: Option<&TypeBuilder>,\n        cb: Option<&ClientRegistry>,\n        collectors: Option<Vec<Arc<Collector>>>,\n        env_vars: HashMap<String, String>,\n        tags: Option<&HashMap<String, String>>,\n        cancel_tripwire: Arc<TripWire>,\n        watch_handler: Option<SharedWatchHandler>,\n    ) -> (anyhow::Result<FunctionResult>, FunctionCallId) {\n        // Find the function.\n        let Some((function_index, function_kind)) =\n            self.program.resolved_function_names.get(&function_name)\n        else {\n            // TODO: We don't have an ID here! We can't call tracer here for llm functions here.\n            return (\n                Err(anyhow!(\"function '{function_name}' not found\")),\n                FunctionCallId::new(),\n            );\n        };\n\n        // If we're not running an expression function, then just delegate the\n        // call to the LLM runtime.\n        if matches!(function_kind, FunctionKind::Llm) {\n            return self\n                .llm_runtime\n                .call_function(\n                    function_name,\n                    params,\n                    ctx,\n                    tb,\n                    cb,\n                    collectors,\n                    env_vars,\n                    tags,","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/async_vm_runtime.rs#L161-L197","documentation":"The async VM runtime resolves the requested function name against `resolved_function_names`; when absent, the call fails immediately with 'function not found' and a fresh FunctionCallId, before any tracing of an LLM call.","triggerScenarios":"call_function (via call_function_sync) with a function_name not present in program.resolved_function_names.","commonSituations":"Calling a function that exists only as an expression function but isn't in the resolved LLM-function map, stale program after edits, or misspelled names.","solutions":["Check the function name spelling against your .baml definitions.","Rebuild/reload the VM program so resolved_function_names is up to date.","Confirm the function is declared as a top-level function in the loaded project."],"exampleFix":"// before\nvm.call_function(\"extract_info\")\n// after\nvm.call_function(\"ExtractInfo\")","handlingStrategy":"validation","validationCode":"if (!program.resolved_function_names.has(functionName)) {\n  throw new Error(`function '${functionName}' not found in program`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["List available functions from program.resolved_function_names keys when debugging.","Reload the program after adding new functions."],"tags":["runtime","not-found","vm","baml"],"backgroundTag":"resource-not-found","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}