go-redis/redis · error

redis: can't parse reply=%.100q reading string into buffer

Error message

redis: can't parse reply=%.100q reading string into buffer

What it means

Error "redis: can't parse reply=%.100q reading string into buffer" thrown in go-redis/redis.

Source

Thrown at internal/proto/reader.go:664

		// Slow path: buffer is exactly large enough for the payload only, so
		// read the payload into it and discard the CRLF separately.
		if _, err := io.ReadFull(r.rd, buf[:n]); err != nil {
			return 0, err
		}
		if _, err := r.rd.Discard(2); err != nil {
			return 0, err
		}
		return n, nil

	case RespInt, RespFloat:
		s := line[1:]
		if len(s) > len(buf) {
			return 0, fmt.Errorf("redis: buffer too small: need %d bytes, have %d", len(s), len(buf))
		}
		return copy(buf, s), nil
	}

	return 0, fmt.Errorf("redis: can't parse reply=%.100q reading string into buffer", line)
}

func (r *Reader) ReadString() (string, error) {
	line, err := r.ReadLine()
	if err != nil {
		return "", err
	}

	switch line[0] {
	case RespStatus, RespInt, RespFloat:
		return string(line[1:]), nil
	case RespString:
		return r.readStringReply(line)
	case RespBool:
		b, err := r.readBool(line)
		return strconv.FormatBool(b), err
	case RespVerbatim:
		return r.readVerb(line)

View on GitHub (pinned to 36d97525cd)

Solutions

  1. Check the quoted reply; it is not a valid string frame for buffered reading
  2. Reconnect to resynchronize

When it happens

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

Common situations: Validate frame type before buffered string reads.


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