go-redis/redis · error
redis: can't peek push notification name, next reply is not
Error message
redis: can't peek push notification name, next reply is not a push notification
What it means
Error "redis: can't peek push notification name, next reply is not a push notification" thrown in go-redis/redis.
Source
Thrown at internal/proto/reader.go:138
//
// To identify the name the method may block reading more bytes from the
// underlying connection, but only ever waits for one byte beyond the valid
// frame prefix it has already seen. That byte is guaranteed to arrive: an
// incomplete prefix means the server is still committed to sending the rest
// of the frame. Demanding any fixed amount instead can deadlock — a complete
// frame such as a subscribe confirmation for a short channel name can be
// smaller than the fixed window, and once it is buffered the server has
// nothing more to send (issue #3935). Blocking for in-flight bytes is
// preferred to a truncated peek, which would silently misidentify the
// notification and cause the caller's ReadReply to consume (and drop) the
// frame; see issue #3839.
func (r *Reader) PeekPushNotificationName() (string, error) {
c, err := r.rd.Peek(1)
if err != nil {
return "", err
}
if c[0] != RespPush {
return "", fmt.Errorf("redis: can't peek push notification name, next reply is not a push notification")
}
const maxPushHeaderPeek = 4096
for {
// Parse from what is already buffered; this never blocks.
avail := r.rd.Buffered()
if avail > maxPushHeaderPeek {
avail = maxPushHeaderPeek
}
buf, peekErr := r.rd.Peek(avail)
if peekErr != nil {
return "", peekErr
}
name, complete, parseErr := parsePushNotificationName(buf)
if parseErr != nil {
return "", parseErr
}View on GitHub (pinned to 36d97525cd)
Solutions
- Only call the push-name peek when a push notification frame (RESP3 '>') is actually next
- Use the standard read path for non-push replies
When it happens
Trigger: Thrown at internal/proto/reader.go:138 when the library encounters an invalid state.
Common situations: Branch on the frame type byte before invoking push-specific parsing.
AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06).
Data as JSON: /data/errors/ab564cb8b4f97ada.json.
Report an issue: GitHub.