{"record":{"id":"fe7518c8ba16a015","repo":"BoundaryML/baml","slug":"unexpected-type-for-status-t","errorCode":null,"errorMessage":"unexpected type for status: %T","messagePattern":"unexpected type for status: %T","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/language_client_go/pkg/rawobjects_http_response.go","lineNumber":49,"sourceCode":"\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}\n\nfunc (h *httpResponse) Headers() (map[string]string, error) {\n\tresult, err := raw_objects.CallMethod(h, \"headers\", nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get headers: %w\", err)\n\t}\n\n\theaders, ok := result.(map[string]string)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unexpected type for headers: %T\", result)\n\t}\n\n\treturn headers, nil\n}","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_go/pkg/rawobjects_http_response.go#L31-L67","documentation":"Thrown by httpResponse.Status() when the FFI call succeeded but the decoded result is not a Go int64. The %T verb names the actual type. The BAML core encodes HTTP status as an integer; a different decoded type signals encoding drift or an unexpected payload from the core.","triggerScenarios":"Calling HTTPResponse.Status() when the core returns the status as a non-int64 CFFI value — typically from a version mismatch between the Rust core and the Go bindings, or a decoder bug mapping the status field.","commonSituations":"Partially upgraded BAML installations; reading objects produced by a different engine version; hand-rolled or patched bindings that changed the status encoding.","solutions":["Upgrade the Go bindings and BAML core to matching versions","Read the %T in the error to identify what arrived and check pkg/cffi integer decoding","Cast defensively only after verifying the type via errors message inspection","File an issue with BAML including the %T value if versions match"],"exampleFix":"status, err := resp.Status()\nif err != nil {\n    return fmt.Errorf(\"non-integer status decoded: %w\", err)\n}","handlingStrategy":"try-catch","validationCode":"if resp == nil { return errors.New(\"nil HTTPResponse\") }","typeGuard":null,"tryCatchPattern":"status, err := resp.Status()\nif err != nil {\n    if strings.Contains(err.Error(), \"unexpected type\") {\n        return 0, fmt.Errorf(\"status decode drift: %w\", err)\n    }\n    return 0, err\n}","preventionTips":["Keep bindings and core on the same version","Treat status as int64 only via the accessor","Capture the %T value when filing bug reports"],"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"}