BoundaryML/baml · error
failed to get request id
Error message
failed to get request id: %w
What it means
Thrown by llmCall.RequestId() in BAML's Go client when raw_objects.CallMethod(l, "http_request_id") fails at the FFI boundary; the core error is wrapped with %w. It means the LLM call object could not serve its associated HTTP request id, typically because the call has no linked HTTP request or the raw object handle is invalid.
Solutions
- Unwrap the error to see the core-side reason (likely 'no http request' for failed calls)
- Check LLMCall.HttpRequest() first; if it returns nil the call never made an HTTP request and has no request id
- Only read RequestId() on completed calls with an attached HTTPRequest/HTTPResponse
- Align Go bindings and BAML core versions
Example fix
id, err := llmCall.RequestId()
if err != nil {
// failed calls may have no http_request_id
if _, hErr := llmCall.HttpRequest(); hErr != nil {
return "", fmt.Errorf("call has no http request: %w", err)
}
return "", err
} Defensive patterns
Strategy: validation
Validate before calling
if _, err := llmCall.HttpRequest(); err != nil {
// no associated http request; skip RequestId()
} Try / catch
id, err := llmCall.RequestId()
if err != nil {
log.Printf("no request id for this call (possibly a failed call): %v", err)
id = ""
} Prevention
- Verify the call has an HTTPRequest before reading its request id
- Only inspect request ids on completed LLM calls
- Keep baml engine and Go bindings on matching versions
When it happens
Trigger: Calling LLMCall.RequestId() on an llmCall raw object for which the core cannot resolve http_request_id — e.g. calls that never issued an HTTP request (client-side failures), stale pointers, or bindings/core version drift.
Common situations: Inspecting failed or synthetic LLM calls in BAML event logs that have no underlying HTTP request; accessing call metadata after runtime teardown; version-mismatched installations.
Understand the failure class
Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.
Related errors
- failed to get body
- failed to get headers
- failed to get id
- failed to get status
- decodeLiteralValue: valueLiteral is nil
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/8dc3107bba7812e4.
Report an issue: GitHub.
Appendix: source
Thrown at engine/language_client_go/pkg/rawobjects_llm_call.go:30
*raw_objects.RawObject
}
func newLLMCall(ptr int64, rt unsafe.Pointer) LLMCall {
return &llmCall{raw_objects.FromPointer(ptr, rt)}
}
func (l *llmCall) ObjectType() cffi.BamlObjectType {
return cffi.BamlObjectType_OBJECT_LLM_CALL
}
func (l *llmCall) pointer() int64 {
return l.RawObject.Pointer()
}
func (l *llmCall) RequestId() (string, error) {
result, err := raw_objects.CallMethod(l, "http_request_id", nil)
if err != nil {
return "", fmt.Errorf("failed to get request id: %w", err)
}
return result.(string), nil
}
func (l *llmCall) ClientName() (string, error) {
result, err := raw_objects.CallMethod(l, "client_name", nil)
if err != nil {
return "", fmt.Errorf("failed to get client name: %w", err)
}
name, ok := result.(string)
if !ok {
return "", fmt.Errorf("unexpected type for client name: %T", result)
}
return name, nil
}View on GitHub (pinned to bd85ce9dee)