go-redis/redis · error
redis: empty push notification name length
Error message
redis: empty push notification name length
What it means
Error "redis: empty push notification name length" thrown in go-redis/redis.
Source
Thrown at internal/proto/reader.go:232
}
typeOfName := buf[pos]
if typeOfName != RespString && typeOfName != RespStatus {
return "", false, fmt.Errorf("redis: can't parse push notification name: %q", buf[pos:])
}
pos++
if typeOfName == RespString {
// Read "$M\r\n" then the M-byte name.
lenStart := pos
next, ok, err := skipDigitsThenCRLF(buf, pos)
if err != nil {
return "", false, fmt.Errorf("redis: can't parse push notification name length: %w", err)
}
if !ok {
return "", false, nil
}
if next-2 == lenStart {
return "", false, fmt.Errorf("redis: empty push notification name length")
}
nameLen, err := util.Atoi(buf[lenStart : next-2])
if err != nil {
return "", false, fmt.Errorf("redis: invalid push notification name length %q: %w", buf[lenStart:next-2], err)
}
if nameLen < 0 {
return "", false, fmt.Errorf("redis: negative push notification name length: %d", nameLen)
}
// Compare against the remaining bytes instead of computing
// next+nameLen: a hugely advertised length on malformed input could
// overflow int, wrap negative, slip past an "end > len(buf)" guard and
// panic the slice below. next <= len(buf) here, so the subtraction is
// safe.
if nameLen > len(buf)-next {
return "", false, nil
}
return util.BytesToString(buf[next : next+nameLen]), true, nil
}View on GitHub (pinned to 36d97525cd)
Solutions
- Treat as malformed server data; reconnect
- Verify the peer is a real Redis server, not a misbehaving proxy
When it happens
Trigger: Thrown at internal/proto/reader.go:232 when the library encounters an invalid state.
Common situations: Handshake-validate the server before enabling push handling.
AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06).
Data as JSON: /data/errors/1fcc6d5255c7a98c.json.
Report an issue: GitHub.