{"record":{"id":"7b3228d61a2d763d","repo":"router-for-me/CLIProxyAPI","slug":"httpwire-chunk-trailers-exceed-d-bytes","errorCode":null,"errorMessage":"httpwire: chunk trailers exceed %d bytes","messagePattern":"httpwire: chunk trailers exceed (.+?) bytes","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/httpwire/ordered_conn.go","lineNumber":269,"sourceCode":"\t\t\tif tracker.dataRemaining == 0 {\n\t\t\t\ttracker.crlfPosition = 0\n\t\t\t\ttracker.state = chunkedReadingDataCRLF\n\t\t\t}\n\t\tcase chunkedReadingDataCRLF:\n\t\t\twant := []byte(\"\\r\\n\")\n\t\t\tif data[consumed] != want[tracker.crlfPosition] {\n\t\t\t\treturn consumed, false, fmt.Errorf(\"httpwire: chunk data is missing CRLF terminator\")\n\t\t\t}\n\t\t\tconsumed++\n\t\t\ttracker.crlfPosition++\n\t\t\tif tracker.crlfPosition == len(want) {\n\t\t\t\ttracker.state = chunkedReadingSize\n\t\t\t}\n\t\tcase chunkedReadingTrailers:\n\t\t\ttracker.trailers = append(tracker.trailers, data[consumed])\n\t\t\tconsumed++\n\t\t\tif len(tracker.trailers) > maxBufferedRequestHeader {\n\t\t\t\treturn consumed, false, fmt.Errorf(\"httpwire: chunk trailers exceed %d bytes\", maxBufferedRequestHeader)\n\t\t\t}\n\t\t\tif bytes.Equal(tracker.trailers, []byte(\"\\r\\n\")) ||\n\t\t\t\t(len(tracker.trailers) >= 4 && bytes.Equal(tracker.trailers[len(tracker.trailers)-4:], []byte(\"\\r\\n\\r\\n\"))) {\n\t\t\t\treturn consumed, true, nil\n\t\t\t}\n\t\tdefault:\n\t\t\treturn consumed, false, fmt.Errorf(\"httpwire: invalid chunk parser state %d\", tracker.state)\n\t\t}\n\t}\n\treturn consumed, false, nil\n}\n\nfunc writeAll(writer io.Writer, data []byte) (int, error) {\n\ttotal := 0\n\tfor len(data) > 0 {\n\t\twritten, errWrite := writer.Write(data)\n\t\ttotal += written\n\t\tif errWrite != nil {","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/httpwire/ordered_conn.go#L251-L287","documentation":"Error \"httpwire: chunk trailers exceed %d bytes\" thrown in router-for-me/CLIProxyAPI.","triggerScenarios":"Thrown at internal/httpwire/ordered_conn.go:269 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Limit or reject chunk trailers beyond the stated byte limit.","Verify the peer's trailer section is well-formed."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}