go-redis/redis · error

redis: can't read raw reply: %.100q

Error message

redis: can't read raw reply: %.100q

What it means

Error "redis: can't read raw reply: %.100q" thrown in go-redis/redis.

Source

Thrown at internal/proto/reader.go:954

			}
			return buf, err
		}
		// Read the attribute key-value pairs. Iterate over pairs rather than
		// n*2 elements so a count above MaxInt/2 can't overflow int to a
		// negative loop bound and skip the body.
		for i := 0; i < n; i++ {
			for pair := 0; pair < 2; pair++ {
				buf, err = r.readRawReplyBuf(buf)
				if err != nil {
					return buf, err
				}
			}
		}
		// Read the command reply that follows the attribute
		return r.readRawReplyBuf(buf)
	}

	return buf, fmt.Errorf("redis: can't read raw reply: %.100q", line)
}

var crlf = []byte{'\r', '\n'}

// ReadRawReplyWriteTo streams the next RESP reply directly to w without intermediate allocations.
// Returns the number of bytes written and any error encountered.
func (r *Reader) ReadRawReplyWriteTo(w io.Writer) (int64, error) {
	return r.readRawReplyWriteTo(w)
}

func (r *Reader) readRawReplyWriteTo(w io.Writer) (int64, error) {
	line, err := r.readLine()
	if err != nil {
		return 0, err
	}

	var written int64
	n, err := w.Write(line)

View on GitHub (pinned to 36d97525cd)

Solutions

  1. Inspect the quoted reply; raw frame reading failed on malformed data
  2. Reconnect and retry the command

When it happens

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

Common situations: Limit raw reads to commands known to need them and validate frame headers first.


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