{"id":"e3132b867241a127","repo":"go-redis/redis","slug":"redis-negative-push-notification-name-length-d","errorCode":null,"errorMessage":"redis: negative push notification name length: %d","messagePattern":"redis: negative push notification name length: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/proto/reader.go","lineNumber":239,"sourceCode":"\tif typeOfName == RespString {\n\t\t// Read \"$M\\r\\n\" then the M-byte name.\n\t\tlenStart := pos\n\t\tnext, ok, err := skipDigitsThenCRLF(buf, pos)\n\t\tif err != nil {\n\t\t\treturn \"\", false, fmt.Errorf(\"redis: can't parse push notification name length: %w\", err)\n\t\t}\n\t\tif !ok {\n\t\t\treturn \"\", false, nil\n\t\t}\n\t\tif next-2 == lenStart {\n\t\t\treturn \"\", false, fmt.Errorf(\"redis: empty push notification name length\")\n\t\t}\n\t\tnameLen, err := util.Atoi(buf[lenStart : next-2])\n\t\tif err != nil {\n\t\t\treturn \"\", false, fmt.Errorf(\"redis: invalid push notification name length %q: %w\", buf[lenStart:next-2], err)\n\t\t}\n\t\tif nameLen < 0 {\n\t\t\treturn \"\", false, fmt.Errorf(\"redis: negative push notification name length: %d\", nameLen)\n\t\t}\n\t\t// Compare against the remaining bytes instead of computing\n\t\t// next+nameLen: a hugely advertised length on malformed input could\n\t\t// overflow int, wrap negative, slip past an \"end > len(buf)\" guard and\n\t\t// panic the slice below. next <= len(buf) here, so the subtraction is\n\t\t// safe.\n\t\tif nameLen > len(buf)-next {\n\t\t\treturn \"\", false, nil\n\t\t}\n\t\treturn util.BytesToString(buf[next : next+nameLen]), true, nil\n\t}\n\n\t// RespStatus: scan for the terminating CRLF.\n\tfor i := pos; i < len(buf)-1; i++ {\n\t\tif buf[i] == '\\r' && buf[i+1] == '\\n' {\n\t\t\treturn util.BytesToString(buf[pos:i]), true, nil\n\t\t}\n\t}","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/internal/proto/reader.go#L221-L257","documentation":"Error \"redis: negative push notification name length: %d\" thrown in go-redis/redis.","triggerScenarios":"Thrown at internal/proto/reader.go:239 when the library encounters an invalid state.","commonSituations":"Never continue reading after a negative length parse error.","solutions":["Reconnect; negative length indicates stream desynchronization or a protocol violation","Verify TLS/proxy layers are not corrupting bytes"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}