{"id":"a179b7041cd61d0b","repo":"go-redis/redis","slug":"redis-empty-push-notification-array-length","errorCode":null,"errorMessage":"redis: empty push notification array length","messagePattern":"redis: empty push notification array length","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/proto/reader.go","lineNumber":208,"sourceCode":"\tif buf[0] != RespPush {\n\t\treturn \"\", false, fmt.Errorf(\"redis: can't parse push notification: %q\", buf)\n\t}\n\n\t// Skip the array length line \">N\\r\\n\".\n\tconst arrayLenStart = 1 // first byte after the '>' marker\n\tpos, ok, err := skipDigitsThenCRLF(buf, arrayLenStart)\n\tif err != nil {\n\t\treturn \"\", false, fmt.Errorf(\"redis: can't parse push notification: %w\", err)\n\t}\n\tif !ok {\n\t\treturn \"\", false, nil\n\t}\n\t// Reject \">\\r\\n\": RESP requires at least one digit for the array length.\n\t// Without this check the empty length looks like a valid prefix and the\n\t// caller would block fetching more bytes for a frame that is already\n\t// malformed.\n\tif pos-2 == arrayLenStart {\n\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)","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/internal/proto/reader.go#L190-L226","documentation":"Error \"redis: empty push notification array length\" thrown in go-redis/redis.","triggerScenarios":"Thrown at internal/proto/reader.go:208 when the library encounters an invalid state.","commonSituations":"Fail the connection on malformed push frames so the pool replaces it.","solutions":["Treat as a protocol violation from the server or proxy; reconnect and re-handshake","Verify RESP3 support of the peer"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}