{"record":{"id":"3a493ef89565dda3","repo":"XTLS/Xray-core","slug":"failed-to-write-response-version","errorCode":null,"errorMessage":"failed to write response version","messagePattern":"failed to write response version","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"proxy/vless/encoding/encoding.go","lineNumber":140,"sourceCode":"\t\t\t\trequest.Port = port\n\t\t\t}\n\t\t}\n\t\tif request.Address == nil {\n\t\t\treturn nil, nil, nil, false, errors.New(\"invalid request address\")\n\t\t}\n\t\treturn id[:], request, requestAddons, false, nil\n\tdefault:\n\t\treturn nil, nil, nil, isfb, errors.New(\"invalid request version\")\n\t}\n}\n\n// EncodeResponseHeader writes encoded response header into the given writer.\nfunc EncodeResponseHeader(writer io.Writer, request *protocol.RequestHeader, responseAddons *Addons) error {\n\tbuffer := buf.StackNew()\n\tdefer buffer.Release()\n\n\tif err := buffer.WriteByte(request.Version); err != nil {\n\t\treturn errors.New(\"failed to write response version\").Base(err)\n\t}\n\n\tif err := EncodeHeaderAddons(&buffer, responseAddons); err != nil {\n\t\treturn errors.New(\"failed to encode response header addons\").Base(err)\n\t}\n\n\tif _, err := writer.Write(buffer.Bytes()); err != nil {\n\t\treturn errors.New(\"failed to write response header\").Base(err)\n\t}\n\n\treturn nil\n}\n\n// DecodeResponseHeader decodes and returns (if successful) a ResponseHeader from an input stream.\nfunc DecodeResponseHeader(reader io.Reader, request *protocol.RequestHeader) (*Addons, error) {\n\tbuffer := buf.StackNew()\n\tdefer buffer.Release()\n","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/proxy/vless/encoding/encoding.go#L122-L158","documentation":"First step of EncodeResponseHeader: writing the echoed version byte into the local buffer failed. This is in-memory serialization before any network write; failure signals an internal buffer/allocation error rather than connection trouble.","triggerScenarios":"Thrown at proxy/vless/encoding/encoding.go:140 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the base error for the internal cause","Treat as non-recoverable for this response; close the connection","Report if reproducible under normal operation"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","contentChangedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}