{"record":{"id":"dc90730453a065ab","repo":"BoundaryML/baml","slug":"failed-to-get-provider-w","errorCode":null,"errorMessage":"failed to get provider: %w","messagePattern":"failed to get provider: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/language_client_go/pkg/rawobjects_llm_call.go","lineNumber":53,"sourceCode":"\nfunc (l *llmCall) ClientName() (string, error) {\n\tresult, err := raw_objects.CallMethod(l, \"client_name\", nil)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to get client name: %w\", err)\n\t}\n\n\tname, ok := result.(string)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"unexpected type for client name: %T\", result)\n\t}\n\n\treturn name, nil\n}\n\nfunc (l *llmCall) Provider() (string, error) {\n\tresult, err := raw_objects.CallMethod(l, \"provider\", nil)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to get provider: %w\", err)\n\t}\n\n\tprovider, ok := result.(string)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"unexpected type for provider: %T\", result)\n\t}\n\n\treturn provider, nil\n}\n\nfunc (l *llmCall) HttpRequest() (HTTPRequest, error) {\n\tresult, err := raw_objects.CallMethod(l, \"http_request\", nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get http request: %w\", err)\n\t}\n\n\trequest, ok := result.(HTTPRequest)\n\tif !ok {","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_go/pkg/rawobjects_llm_call.go#L35-L71","documentation":"LLMCall.Provider() wraps any error from the FFI CallMethod(l, \"provider\", nil) used to read the provider name (e.g. OpenAI, Anthropic) of an LLM call. It means the BAML runtime failed to resolve or return the \"provider\" attribute on this call object. This is a binding-level failure — the call object handle or the attribute dispatch across the Go/Rust boundary did not work.","triggerScenarios":"Calling Provider() on an llmCall whose RawObject pointer is stale or freed on the Rust side, or when the runtime errors while dispatching the \"provider\" method on the object.","commonSituations":"Accessing the LLMCall after the runtime released its objects (e.g. storing it past the end of a streamed function call); version skew between the Go bindings and native runtime removing/renaming \"provider\"; cross-thread access to runtime-owned objects.","solutions":["Read provider within the same scope/callback where the LLMCall is produced, before runtime cleanup.","Update the BAML Go bindings and native runtime to matching versions and regenerate.","Unwrap the error (errors.Unwrap) to see the specific FFI failure reason.","Use the trace/event metadata for provider info when post-call access fails."],"exampleFix":"// before: deferred access to a stored call\nprovider, err := storedCall.Provider()\n\n// after: access inside the callback\nonEvent := func(ev baml.Event) {\n    provider, err := ev.Call().Provider()\n    if err != nil {\n        log.Printf(\"provider unavailable: %v\", err)\n    }\n}","handlingStrategy":"try-catch","validationCode":"if call == nil || reflect.ValueOf(call).IsNil() {\n    return errors.New(\"llm call object is nil/stale; cannot read provider\")\n}","typeGuard":null,"tryCatchPattern":"provider, err := call.Provider()\nif err != nil {\n    log.Printf(\"provider unavailable: %v\", err)\n    provider = \"unknown\"\n}","preventionTips":["Read provider attributes while the call object is still live.","Match runtime and binding versions.","Do not hold call objects beyond function completion.","Unwrap chained errors for root-cause diagnosis."],"tags":["ffi","runtime","binding","baml"],"backgroundTag":"internal-invariant-violation","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}