{"record":{"id":"8fc5d4a748141730","repo":"BoundaryML/baml","slug":"failed-to-get-headers-w","errorCode":null,"errorMessage":"failed to get headers: %w","messagePattern":"failed to get headers: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/language_client_go/pkg/rawobjects_http_request.go","lineNumber":72,"sourceCode":"\nfunc (h *httpRequest) Method() (string, error) {\n\tresult, err := raw_objects.CallMethod(h, \"method\", nil)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to get method: %w\", err)\n\t}\n\n\tmethod, ok := result.(string)\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"unexpected type for method: %T\", result)\n\t}\n\n\treturn method, nil\n}\n\nfunc (h *httpRequest) 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}\n\nfunc (h *httpRequest) Body() (HTTPBody, error) {\n\tresult, err := raw_objects.CallMethod(h, \"body\", nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get body: %w\", err)\n\t}\n\n\tbody, ok := result.(HTTPBody)\n\tif !ok {","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_go/pkg/rawobjects_http_request.go#L54-L90","documentation":"httpRequest.Headers() invokes the runtime 'headers' method via the raw-objects bridge. 'failed to get headers: %w' means the bridge call failed before any headers were produced — the underlying object could not execute 'headers'.","triggerScenarios":"Calling Headers() on an invalid or detached request object, or when the runtime 'headers' implementation throws (e.g. header parsing failed in the runtime).","commonSituations":"Reading headers after runtime disposal; handlers erroring while normalizing header names; version mismatches.","solutions":["Inspect the wrapped cause (%w)","Keep request access within the dispatch lifecycle","Ensure the runtime defines a working 'headers' method","Re-dispatch the request if stale"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if req == nil { return errors.New(\"request unavailable\") }","typeGuard":"func (h *httpRequest) hasHeaders() bool { return h != nil && h.RawObject != nil }","tryCatchPattern":"hs, err := req.Headers()\nif err != nil {\n    return fmt.Errorf(\"cannot read headers: %w\", err)\n}","preventionTips":["Read headers before the request lifecycle ends","Keep runtime 'headers' implementations exception-free","Sync client/runtime versions"],"tags":["go","runtime-bridge","http-headers"],"backgroundTag":"method-not-implemented","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}