{"record":{"id":"64af0393b88522ce","repo":"tailscale/tailscale","slug":"error-marshaling-request-event-w","errorCode":null,"errorMessage":"error marshaling request event: %w","messagePattern":"error marshaling request event: %w","errorType":"http","errorClass":null,"httpStatus":502,"severity":"error","filePath":"k8s-operator/api-proxy/proxy.go","lineNumber":414,"sourceCode":"\t\tevent.Source.NodeUserID = who.UserProfile.ID\n\t} else {\n\t\tevent.Source.NodeTags = who.Node.Tags\n\t}\n\n\tbodyBytes, err := io.ReadAll(req.Body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read body: %w\", err)\n\t}\n\treq.Body = io.NopCloser(bytes.NewReader(bodyBytes))\n\tevent.Request.Body = bodyBytes\n\n\tvar errs []error\n\t// TODO: ChaosInTheCRD ensure that if there are multiple addrs timing out we don't experience slowdown on client waiting for response.\n\tfail := true\n\tfor _, addr := range addrs {\n\t\tdata := new(bytes.Buffer)\n\t\tif err := json.NewEncoder(data).Encode(event); err != nil {\n\t\t\treturn fmt.Errorf(\"error marshaling request event: %w\", err)\n\t\t}\n\n\t\tif err := ap.sendEventFunc(addr, data, ap.ts.Dial); err != nil {\n\t\t\tif apiSupportErr, ok := err.(sessionrecording.EventAPINotSupportedErr); ok {\n\t\t\t\tap.log.Warnf(apiSupportErr.Error())\n\t\t\t\tfail = false\n\t\t\t} else {\n\t\t\t\terr := fmt.Errorf(\"error sending event to recorder with address %q: %v\", addr.String(), err)\n\t\t\t\terrs = append(errs, err)\n\t\t\t}\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tmerr := errors.Join(errs...)\n\tif fail && failOpen {\n\t\tmsg := fmt.Sprintf(\"[unexpected] failed to send event to recorders with errors: %s\", merr.Error())","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/tailscale/tailscale/blob/6e0912f97994f927632b34ae9e63b53d6516a6ac/k8s-operator/api-proxy/proxy.go#L396-L432","documentation":"JSON-encoding the assembled session recording event failed before it could be sent to any recorder; the event struct contains channels or unsupported value types only under internal misuse, so this is effectively an invariant violation.","triggerScenarios":"Thrown at k8s-operator/api-proxy/proxy.go:414 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Marshaling the request event failed; internal serialization error — upgrade the operator and retry."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6e0912f97994f927632b34ae9e63b53d6516a6ac","analyzedAt":"2026-08-18T08:17:25.280Z","contentChangedAt":"2026-08-18T08:17:25.280Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}