go-redis/redis · error
redis: can't parse push notification: %w
Error message
redis: can't parse push notification: %w
What it means
Error "redis: can't parse push notification: %w" thrown in go-redis/redis.
Source
Thrown at internal/proto/reader.go:198
// name; the caller should fetch more bytes and retry.
// - ("", _, err): buf is malformed.
//
// This split lets PeekPushNotificationName tell "incomplete header" apart
// from "corrupt frame" without ever returning a truncated string.
func parsePushNotificationName(buf []byte) (string, bool, error) {
// Need at least ">N\r" before any meaningful work.
if len(buf) < 3 {
return "", false, nil
}
if buf[0] != RespPush {
return "", false, fmt.Errorf("redis: can't parse push notification: %q", buf)
}
// Skip the array length line ">N\r\n".
const arrayLenStart = 1 // first byte after the '>' marker
pos, ok, err := skipDigitsThenCRLF(buf, arrayLenStart)
if err != nil {
return "", false, fmt.Errorf("redis: can't parse push notification: %w", err)
}
if !ok {
return "", false, nil
}
// Reject ">\r\n": RESP requires at least one digit for the array length.
// Without this check the empty length looks like a valid prefix and the
// caller would block fetching more bytes for a frame that is already
// malformed.
if pos-2 == arrayLenStart {
return "", false, fmt.Errorf("redis: empty push notification array length")
}
// First element type byte: '$' (bulk) or '+' (simple-string).
if pos >= len(buf) {
return "", false, nil
}
typeOfName := buf[pos]
if typeOfName != RespString && typeOfName != RespStatus {View on GitHub (pinned to 36d97525cd)
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
When it happens
Trigger: Thrown at internal/proto/reader.go:198 when the library encounters an invalid state.
Common situations: Serialize all reads on a connection through the client; never read the raw conn concurrently.
AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06).
Data as JSON: /data/errors/44187bfa669b5629.json.
Report an issue: GitHub.