BoundaryML/baml · error · BridgeError

Function not found

Error message

Function not found: {name}

What it means

BridgeError::FunctionNotFound carries the missing function's name. The bridge looked up call_target in the loaded BAML runtime's function registry and found no matching function. This means the name does not exist in the compiled BAML project the engine was initialized with.

Solutions

  1. Verify the exact function name (including case) matches a function declared in your .baml files.
  2. Rebuild/re-initialize the runtime so it includes the latest .baml definitions.
  3. List available functions from the runtime (if exposed) to check spelling.
  4. Ensure the correct project directory was passed to create_baml_runtime.

Example fix

// before
args.call_target = "ExtractResum";
// after
args.call_target = "ExtractResume"; // matches `function ExtractResume(...)`,
Defensive patterns

Strategy: validation

Validate before calling

known = {'ExtractResume', 'ClassifyDoc'}  # keep in sync with .baml files
if args.call_target not in known:
    raise ValueError(f'unknown BAML function: {args.call_target}')

Try / catch

try:
    bridge.call_function(args)
except BridgeError as e:
    if e is BridgeError.FunctionNotFound:
        log.error(f'Function {e.name} not in project; check .baml files and rebuild')

Prevention

When it happens

Trigger: Calling call_function with a call_target name that is not defined in the loaded BAML project; typo'd function names; calling a function defined only in a different project version.

Common situations: Typo or casing mismatch between client and .baml file; renaming a BAML function without updating callers; runtime initialized from a stale build that predates the new function.

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/cb495e5626943191. Report an issue: GitHub.

Appendix: source

Thrown at baml_language/crates/bridge_cffi/src/error.rs:28

    #[error("Engine not initialized. Call create_baml_runtime first.")]
    NotInitialized,

    #[error("Project not initialized")]
    ProjectNotInitialized,

    #[error("Engine lock poisoned")]
    LockPoisoned,

    #[error("{0}")]
    Runtime(#[from] bex_project::RuntimeError),

    #[error("CallFunctionArgs.call_target must be set")]
    MissingCallTarget,

    #[error("type arguments are not supported when invoking a BAML function handle")]
    FunctionHandleTypeArgs,

    #[error("Function not found: {name}")]
    FunctionNotFound { name: String },

    #[error("Missing argument '{parameter}' for function '{function}'")]
    MissingArgument { function: String, parameter: String },

    #[error("Not implemented: {0}")]
    NotImplemented(String),

    #[error("call_id {0} is already in use by an active call")]
    DuplicateCallId(u64),

    #[error("call_id must be a nonzero uint64")]
    InvalidCallId,

    #[error("Internal error: {0}")]
    Internal(String),

    #[error("{0}")]

View on GitHub (pinned to bd85ce9dee)