{"record":{"id":"8aba08463ed5167b","repo":"BoundaryML/baml","slug":"unexpected-type-for-id-t-rawobjects-http-response","errorCode":null,"errorMessage":"unexpected type for id: %T","messagePattern":"unexpected type for id: %T","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/language_client_go/pkg/rawobjects_http_response.go","lineNumber":35,"sourceCode":"}\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 {\n\t\treturn 0, fmt.Errorf(\"unexpected type for status: %T\", result)\n\t}\n\n\treturn status, nil\n}","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_go/pkg/rawobjects_http_response.go#L17-L53","documentation":"Thrown by httpResponse.RequestId() when the FFI CallMethod(\"id\") succeeded but the decoded result is not a Go string. The %T verb reports the actual decoded type. This indicates the core returned the id in an unexpected representation (e.g. an integer or wrapped object) relative to what the Go bindings expect.","triggerScenarios":"Calling HTTPResponse.RequestId() when the core's id field decodes to a non-string CFFI value — typically after a version mismatch where the id representation changed between the core and Go bindings.","commonSituations":"Upgraded BAML core with older Go bindings (or vice versa); event-log data produced by a different BAML version; corrupted decoding of the id payload.","solutions":["Upgrade the Go bindings and BAML core to the same release so the id is decoded as a string","Check the %T in the error to identify the actual decoded type and search pkg/cffi for the corresponding decoder","Fall back to LLMCall.RequestId() which reads http_request_id if the response id is unusable","Report to BAML maintainers with the %T value if versions are already aligned"],"exampleFix":"id, err := resp.RequestId()\nif err != nil {\n    // guard against non-string decode\n    return fmt.Errorf(\"request id not usable: %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    if strings.Contains(err.Error(), \"unexpected type\") {\n        return \"\", fmt.Errorf(\"id decode drift, check versions: %w\", err)\n    }\n    return \"\", err\n}","preventionTips":["Upgrade bindings and engine together","Log the %T value from the error when reporting issues","Use LLMCall.RequestId() as a fallback correlation key"],"tags":["go","type-assertion","ffi","baml"],"backgroundTag":"type-mismatch","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"}