{"record":{"id":"e8822a8591523db8","repo":"BoundaryML/baml","slug":"function-name-is-not-invokable-as-an-entry-point-kind-kind","errorCode":null,"errorMessage":"Function `{name}` is not invokable as an entry point (kind: {kind})","messagePattern":"Function `(.+?)` is not invokable as an entry point \\(kind: (.+?)\\)","errorType":"exception","errorClass":"EngineError","httpStatus":null,"severity":"error","filePath":"baml_language/crates/bex_engine/src/lib.rs","lineNumber":816,"sourceCode":"    #[error(\"BAML engine is shutting down\")]\n    ShuttingDown,\n\n    #[error(\"Function call with ID {call_id} not found\")]\n    FunctionCallNotFound { call_id: CallId },\n\n    #[error(\"Future with ID {future_id} not found\")]\n    FutureNotFound { future_id: FutureId },\n\n    #[error(\"Function not found: {name}\")]\n    FunctionNotFound { name: String },\n\n    /// Function exists, but its `FunctionKind` is not invokable as an\n    /// engine entry point. Only bytecode functions can be called via\n    /// [`BexEngine::call_function`] / [`BexEngine::call_function_bound_args`]:\n    /// native (`$rust_function`) entries would re-enter the VM through\n    /// `YieldToCall` with no bytecode frame to return to. Sysops + builtins\n    /// reach their natives from inside a calling bytecode body.\n    #[error(\"Function `{name}` is not invokable as an entry point (kind: {kind})\")]\n    NotInvokableAsEntry { name: String, kind: String },\n\n    #[error(\"VM internal error: {0}\")]\n    VmInternalError(bex_vm::errors::VmInternalError),\n\n    #[error(\"{}\", format_vm_internal_error(source, trace))]\n    TracedVmInternalError {\n        source: bex_vm::errors::VmInternalError,\n        trace: Vec<bex_vm::StackFrame>,\n    },\n\n    /// Either a BAML panic or a BAML error value.\n    #[error(\"{}\", format_unhandled_throw(value, trace))]\n    UnhandledThrow {\n        value: Box<BexExternalValue>,\n        trace: Vec<bex_vm::StackFrame>,\n    },\n","sourceCodeStart":798,"sourceCodeEnd":834,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/bex_engine/src/lib.rs#L798-L834","documentation":"`EngineError::NotInvokableAsEntry` is raised when a function exists but its `FunctionKind` cannot serve as an engine entry point. Only bytecode functions may be invoked via `BexEngine::call_function` / `call_function_bound_args`; native (`$rust_function`) entries would re-enter the VM through `YieldToCall` with no bytecode frame to return to, and sysops/builtins are reached from inside a calling bytecode body.","triggerScenarios":"Passing the name of a native function, sysop, or builtin to `call_function` / `call_function_bound_args`; the kind is embedded in the error message.","commonSituations":"Trying to call a Rust-implemented builtin directly from the host; scripting against internal engine primitives as if they were BAML functions.","solutions":["Invoke a bytecode (BAML-defined) function instead; have it call the native internally.","Call native/builtin functionality through its direct Rust API rather than the engine entry point.","Check the function's `FunctionKind` before invoking if constructing names dynamically."],"exampleFix":"// before\nengine.call_function(\"$rust_function_concat\", args).await?;\n// after\nengine.call_function(\"MyBamlWorkflow\", args).await?; // bytecode fn that calls the native","handlingStrategy":"validation","validationCode":"// rust\nlet f = engine.lookup_function(name)?;\nif f.kind() != FunctionKind::Bytecode { /* route elsewhere */ }","typeGuard":"fn is_bytecode_entry(kind: &FunctionKind) -> bool { matches!(kind, FunctionKind::Bytecode) }","tryCatchPattern":null,"preventionTips":["Only expose bytecode BAML functions as callable entry points","Call natives/builtins through their Rust APIs directly","Check FunctionKind before dynamic dispatch by name"],"tags":["engine","entry-point","vm","rust"],"backgroundTag":"unsupported-operation","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}