{"record":{"id":"eca00fcd91f1e05a","repo":"BoundaryML/baml","slug":"failed-to-get-body-w","errorCode":null,"errorMessage":"failed to get body: %w","messagePattern":"failed to get body: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/language_client_go/pkg/rawobjects_http_request.go","lineNumber":86,"sourceCode":"\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 {\n\t\treturn nil, fmt.Errorf(\"unexpected type for body: %T\", result)\n\t}\n\n\treturn body, nil\n}\n","sourceCodeStart":68,"sourceCodeEnd":96,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_go/pkg/rawobjects_http_request.go#L68-L96","documentation":"httpRequest.Body() invokes the runtime 'body' method via the raw-objects bridge and expects an HTTPBody implementation back. 'failed to get body: %w' means the bridge call failed — the runtime could not produce a body object for this request.","triggerScenarios":"Calling Body() on an invalid/detached request, or when the runtime 'body' method raises (e.g. streaming body unavailable, body already consumed).","commonSituations":"Accessing a request body after the handler consumed it; requests constructed without bodies in older runtime versions; client/runtime version drift.","solutions":["Inspect the wrapped cause (%w) for the runtime-side error","Access Body() once, before other code consumes the request stream","Confirm the runtime provides a 'body' object for this request type","Re-dispatch the request to get a fresh body"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if req == nil { return errors.New(\"request unavailable\") }","typeGuard":"func (h *httpRequest) hasBody() bool { return h != nil && h.RawObject != nil }","tryCatchPattern":"body, err := req.Body()\nif err != nil {\n    return fmt.Errorf(\"request body unavailable: %w\", err)\n}","preventionTips":["Read Body() exactly once, before other consumers","Do not assume every request carries a body; handle absence gracefully","Keep Go client and runtime versions aligned"],"tags":["go","runtime-bridge","http-body"],"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"}