BoundaryML/baml · error
failed to get selected call: %w
Error message
failed to get selected call: %w
What it means
SelectedCall() fetches the currently selected LLM call via the 'selected_call' bridge method. This error wraps any failure of the bridge call itself (transport error, missing method, runtime exception), distinct from the type-assertion failure thrown right after.
Source
Thrown at engine/language_client_go/pkg/rawobjects_function_log.go:144
result, err := raw_objects.CallMethod(f, "calls", nil)
if err != nil {
return nil, fmt.Errorf("failed to get calls: %w", err)
}
result_cast := result.([]raw_objects.RawPointer)
calls := make([]LLMCall, len(result_cast))
for i, call := range result_cast {
calls[i] = call.(LLMCall)
}
return calls, nil
}
func (f *functionLog) SelectedCall() (LLMCall, error) {
result, err := raw_objects.CallMethod(f, "selected_call", nil)
if err != nil {
return nil, fmt.Errorf("failed to get selected call: %w", err)
}
call, ok := result.(LLMCall)
if !ok {
return nil, fmt.Errorf("unexpected type for selected call: %T", result)
}
return call, nil
}
func (f *functionLog) Tags() (map[string]any, error) {
result, err := raw_objects.CallMethod(f, "tags", nil)
if err != nil {
return nil, fmt.Errorf("failed to get tags: %w", err)
}
tags, ok := result.(map[string]any)
if !ok {View on GitHub (pinned to bd85ce9dee)
Solutions
- Read the wrapped root cause from the error chain
- Verify 'selected_call' exists in the connected runtime version
- Ensure the function has produced a call selection before querying
Defensive patterns
Strategy: try-catch
Validate before calling
if flog == nil { return nil, errors.New("nil function log") } Try / catch
call, err := flog.SelectedCall()
if err != nil {
return nil, fmt.Errorf("no selected call available: %w", err)
} Prevention
- Only query SelectedCall after the function has produced calls
- Check runtime version compatibility for the 'selected_call' method
- Treat 'no selection yet' as an expected state in your flow
When it happens
Trigger: Calling FunctionLog.SelectedCall() when the bridge call fails: the runtime object is invalid, the 'selected_call' method is absent, or the runtime raises while resolving the selected call.
Common situations: Querying selected call before the function produced/selected any call and the runtime errors instead of returning nil; runtime/runtime-binding version drift; stale disposed object handle.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- failed to get calls count: %w
- failed to get calls: %w
- failed to get tags: %w
- unexpected type for raw LLM response: %T
- failed to get text: %w
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/a99d52e31003074c.
Report an issue: GitHub.