{"record":{"id":"f72f792bcdf07f79","repo":"BoundaryML/baml","slug":"failed-to-get-id-w-rawobjects-http-response","errorCode":null,"errorMessage":"failed to get id: %w","messagePattern":"failed to get id: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/language_client_go/pkg/rawobjects_http_response.go","lineNumber":30,"sourceCode":"\t*raw_objects.RawObject\n}\n\nfunc newHttpResponse(ptr int64, rt unsafe.Pointer) HTTPResponse {\n\treturn &httpResponse{raw_objects.FromPointer(ptr, rt)}\n}\n\nfunc (h *httpResponse) ObjectType() cffi.BamlObjectType {\n\treturn cffi.BamlObjectType_OBJECT_HTTP_RESPONSE\n}\n\nfunc (h *httpResponse) pointer() int64 {\n\treturn h.RawObject.Pointer()\n}\n\nfunc (h *httpResponse) RequestId() (string, error) {\n\tresult, err := raw_objects.CallMethod(h, \"id\", nil)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to get id: %w\", err)\n\t}\n\n\tid, ok := result.(string)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"unexpected type for id: %T\", result)\n\t}\n\n\treturn id, nil\n}\n\nfunc (h *httpResponse) Status() (int64, error) {\n\tresult, err := raw_objects.CallMethod(h, \"status\", nil)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"failed to get status: %w\", err)\n\t}\n\n\tstatus, ok := result.(int64)\n\tif !ok {","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_go/pkg/rawobjects_http_response.go#L12-L48","documentation":"Thrown by httpResponse.RequestId() in BAML's Go client when raw_objects.CallMethod(h, \"id\") fails on the FFI boundary. The returned error from the Rust core (object lookup failure, method not found on the raw object, or expired/invalid pointer) is wrapped with %w. It is not a Go-side type problem; the id method call itself failed.","triggerScenarios":"Calling HTTPResponse.RequestId() on a response object whose underlying raw pointer cannot serve the \"id\" method — e.g. the object handle was not properly initialized, the core returned an error for the method invocation, or the object has been released.","commonSituations":"Inspecting HTTPResponse objects obtained from BAML event logs/callbacks where the raw object registry no longer holds the pointer; version drift between Go bindings and the core library so the \"id\" method name is unknown to the core.","solutions":["Unwrap the error with errors.Unwrap/errors.As to see the underlying FFI failure before acting","Ensure the HTTPResponse object is still alive and obtained directly from the same runtime (not from a stale log entry or after runtime teardown)","Align Go binding and BAML core versions so the \"id\" method exists on the core side","If only the id is needed and unavailable, correlate via LLMCall.RequestId() (http_request_id) instead"],"exampleFix":"id, err := resp.RequestId()\nif err != nil {\n    // before: id unavailable, whole operation aborted silently\n    // after: inspect the wrapped cause\n    return fmt.Errorf(\"response id lookup failed: %w\", err)\n}","handlingStrategy":"try-catch","validationCode":"if resp == nil { return errors.New(\"nil HTTPResponse\") }","typeGuard":null,"tryCatchPattern":"id, err := resp.RequestId()\nif err != nil {\n    log.Printf(\"response id unavailable: %v\", err)\n    id = \"\" // degrade gracefully\n}","preventionTips":["Read ids from live objects, not handles kept past runtime teardown","Pin matching baml core and Go binding versions","Unwrap errors to distinguish FFI failures from type problems"],"tags":["go","ffi","baml","method-call"],"backgroundTag":"api-request-failed","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}