BoundaryML/baml · error · BridgeError
call_id {0} is already in use by an active call
Error message
call_id {0} is already in use by an active call What it means
BridgeError::DuplicateCallId carries the conflicting id. The bridge tracks in-flight calls by call_id so results can be routed back to the right caller; registering a new call with an id that already belongs to an active call is rejected to prevent result cross-wiring.
Source
Thrown at baml_language/crates/bridge_cffi/src/error.rs:37
#[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}")]
Startup(String),
}
View on GitHub (pinned to bd85ce9dee)
Solutions
- Generate unique call_ids (e.g. monotonic counter or UUID-derived integer) for every call.
- Wait for or cancel the active call holding that id before reusing it.
- Fix id generators that reset between retries or threads.
- Consume pending results promptly so ids retire.
Example fix
// before let call_id = 42; // reused every call // after static NEXT_ID: AtomicU64 = AtomicU64::new(1); let call_id = NEXT_ID.fetch_add(1, Ordering::Relaxed);
Defensive patterns
Strategy: validation
Validate before calling
if call_id in active_calls:
raise ValueError(f'call_id {call_id} still active') Try / catch
try:
bridge.call_start(args)
except BridgeError as e:
if e is BridgeError.DuplicateCallId:
args.call_id = new_unique_id()
bridge.call_start(args) Prevention
- Use a process-wide monotonic id generator
- Never reset id counters while calls are pending
- Complete or cancel calls before reusing ids
When it happens
Trigger: Starting a new asynchronous bridge call with a call_id equal to one from a call that has not yet completed or been consumed; reusing ids without waiting for completion; calling code that resets its id counter while calls are still active.
Common situations: Retry logic re-submitting with the same id after a timeout while the original call still runs; id generators restarting per process/thread; forgetting to retrieve or cancel a pending call before issuing the next.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- call_id must be a nonzero uint64
- -32801
- timed out waiting for install lock {}
- A function call with ID {call_id} is already in progress
- trace call process id must be 16 bytes, got {}
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/8b60f13233c7643d.
Report an issue: GitHub.