{"id":"44187bfa669b5629","repo":"go-redis/redis","slug":"redis-can-t-parse-push-notification-w","errorCode":null,"errorMessage":"redis: can't parse push notification: %w","messagePattern":"redis: can't parse push notification: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/proto/reader.go","lineNumber":198,"sourceCode":"//     name; the caller should fetch more bytes and retry.\n//   - (\"\", _, err):      buf is malformed.\n//\n// This split lets PeekPushNotificationName tell \"incomplete header\" apart\n// from \"corrupt frame\" without ever returning a truncated string.\nfunc parsePushNotificationName(buf []byte) (string, bool, error) {\n\t// Need at least \">N\\r\" before any meaningful work.\n\tif len(buf) < 3 {\n\t\treturn \"\", false, nil\n\t}\n\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 {","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/internal/proto/reader.go#L180-L216","documentation":"Error \"redis: can't parse push notification: %w\" thrown in go-redis/redis.","triggerScenarios":"Thrown at internal/proto/reader.go:198 when the library encounters an invalid state.","commonSituations":"Serialize all reads on a connection through the client; never read the raw conn concurrently.","solutions":["Inspect the wrapped error for the underlying parse failure (truncated frame, bad length)","Ensure the connection is not shared with another reader corrupting framing"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}