go-redis/redis · error

redis: can't parse push notification: %q

Error message

redis: can't parse push notification: %q

What it means

Error "redis: can't parse push notification: %q" thrown in go-redis/redis.

Source

Thrown at internal/proto/reader.go:191

}

// parsePushNotificationName extracts the notification name from a buffered
// RESP3 push frame prefix. The three return values are:
//
//   - (name, true, nil): the full name is in buf.
//   - ("", false, nil):  buf is a valid prefix but too short to determine the
//     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")
	}

View on GitHub (pinned to 36d97525cd)

Solutions

  1. Verify the server speaks the expected RESP version (RESP3) for push notifications
  2. Check for a proxy/middlebox mangling frames

When it happens

Trigger: Thrown at internal/proto/reader.go:191 when the library encounters an invalid state.

Common situations: Validate negotiated protocol at HELLO and disable push features on RESP2.


AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06). Data as JSON: /data/errors/a0b7409a9f404223.json. Report an issue: GitHub.