BoundaryML/baml · error · BridgeError
CallFunctionArgs.call_target must be set
Error message
CallFunctionArgs.call_target must be set
What it means
BridgeError::MissingCallTarget from the bridge_cffi crate. It is raised when a call_function operation is invoked with CallFunctionArgs whose call_target field was never set. The bridge needs to know which BAML function to invoke; a null/absent call_target is rejected before any lookup happens.
Source
Thrown at baml_language/crates/bridge_cffi/src/error.rs:22
/// Errors that can occur during bridge operations.
#[derive(Debug, Error)]
pub enum BridgeError {
#[error(transparent)]
Ctypes(#[from] bridge_ctypes::CtypesError),
#[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")]View on GitHub (pinned to bd85ce9dee)
Solutions
- Set CallFunctionArgs.call_target to the name of the BAML function you want to invoke before calling.
- If using ctypes, explicitly assign the field rather than relying on zero-initialized memory.
- Regenerate or update FFI bindings so the call_target field exists and is populated.
- Add a client-side assert that call_target is a non-empty string before invoking.
Example fix
// before
let args = CallFunctionArgs { call_id: 1, ..Default::default() };
// after
let args = CallFunctionArgs { call_id: 1, call_target: Some("ExtractResume".into()), ..Default::default() }; Defensive patterns
Strategy: validation
Validate before calling
if not args.call_target:
raise ValueError("call_target must be set before invoking") Type guard
def has_call_target(args) -> bool:
return bool(getattr(args, 'call_target', None)) Try / catch
try:
bridge.call_function(args)
except BridgeError as e:
if 'call_target must be set' in str(e):
fix_and_retry_with_target(args) Prevention
- Always populate call_target at args construction time
- Use a constructor/factory that requires the target
- Assert non-empty target in FFI wrapper helpers
When it happens
Trigger: Calling the bridge's function-invocation entry point with CallFunctionArgs constructed without assigning call_target (e.g. left at its default/None), typically via the CFFI/ctypes layer.
Common situations: Hand-building the args struct in FFI bindings and forgetting a field; zero-initialized structs in C/ctypes where an empty string or null target silently passes validation; code generated from outdated bindings missing the call_target field.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Missing argument '{parameter}' for function '{function}'
- call_id must be a nonzero uint64
- {0}
- Invalid bigint hex string ({len} bytes)
- Invalid decimal bigint literal ({len} bytes)
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/6d126645c6206e66.
Report an issue: GitHub.