BoundaryML/baml · error · BridgeError
call_id must be a nonzero uint64
Error message
call_id must be a nonzero uint64
What it means
FFI argument validation error from the bridge_cffi layer: the call_id passed over the C boundary is zero. Call ids are used to correlate in-flight calls with their results, so zero is reserved/invalid; callers must supply a distinct nonzero uint64 for each call.
Source
Thrown at baml_language/crates/bridge_cffi/src/error.rs:40
#[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}")]
Startup(String),
}
View on GitHub (pinned to bd85ce9dee)
Solutions
- Assign a nonzero call_id (start counters at 1) before invoking.
- Validate call_id > 0 client-side before crossing the FFI boundary.
- Check integer width conversions so the value fits in uint64.
- Explicitly initialize ctypes structs instead of relying on zeroed memory.
Example fix
// before args.call_id = 0; // after args.call_id = next_id(); // guaranteed >= 1
Defensive patterns
Strategy: validation
Validate before calling
if not (0 < call_id <= 2**64 - 1):
raise ValueError('call_id must be a nonzero uint64') Type guard
def valid_call_id(v) -> bool:
return isinstance(v, int) and 0 < v < 2**64 Try / catch
try:
bridge.call_start(args)
except BridgeError as e:
if e is BridgeError.InvalidCallId:
args.call_id = next_id() # starts at 1
bridge.call_start(args) Prevention
- Start id counters at 1, not 0
- Explicitly assign call_id in ctypes structs
- Range-check integers before crossing the FFI boundary
When it happens
Trigger: Passing call_id = 0 (or an unset/default-initialized field) to a call_start or call-related bridge function; passing a value that overflows u64 from a wider client-side integer.
Common situations: Zero-initialized C structs in ctypes users who never assign call_id; languages where the default integer is 0; sign/overflow issues when converting from i64 or arbitrary-precision ints.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- CallFunctionArgs.call_target must be set
- Missing argument '{parameter}' for function '{function}'
- call_id {0} is already in use by an active call
- {0}
- Invalid bigint hex string ({len} bytes)
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/b3e89fb84c0342c8.
Report an issue: GitHub.