{"id":"f9eca294c60b549f","repo":"go-redis/redis","slug":"redis-can-t-parse-push-notification-name-length","errorCode":null,"errorMessage":"redis: can't parse push notification name length: %w","messagePattern":"redis: can't parse push notification name length: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/proto/reader.go","lineNumber":226,"sourceCode":"\t\treturn \"\", false, fmt.Errorf(\"redis: empty push notification array length\")\n\t}\n\n\t// First element type byte: '$' (bulk) or '+' (simple-string).\n\tif pos >= len(buf) {\n\t\treturn \"\", false, nil\n\t}\n\ttypeOfName := buf[pos]\n\tif typeOfName != RespString && typeOfName != RespStatus {\n\t\treturn \"\", false, fmt.Errorf(\"redis: can't parse push notification name: %q\", buf[pos:])\n\t}\n\tpos++\n\n\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","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/internal/proto/reader.go#L208-L244","documentation":"Error \"redis: can't parse push notification name length: %w\" thrown in go-redis/redis.","triggerScenarios":"Thrown at internal/proto/reader.go:226 when the library encounters an invalid state.","commonSituations":"Keep socket ownership exclusive to the client connection.","solutions":["Inspect the wrapped error; usually indicates a truncated or corrupted frame length field","Ensure no other process reads from the same socket"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}