go-redis/redis · error

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

Error message

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

What it means

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

Source

Thrown at internal/proto/reader.go:690

	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)
	case RespBigInt:
		b, err := r.readBigInt(line)
		if err != nil {
			return "", err
		}
		return b.String(), nil
	}
	return "", fmt.Errorf("redis: can't parse reply=%.100q reading string", line)
}

func (r *Reader) ReadBool() (bool, error) {
	s, err := r.ReadString()
	if err != nil {
		return false, err
	}
	return s == "OK" || s == "1" || s == "true", nil
}

func (r *Reader) ReadSlice() ([]interface{}, error) {
	line, err := r.ReadLine()
	if err != nil {
		return nil, err
	}
	return r.readSlice(line)
}

View on GitHub (pinned to 36d97525cd)

Solutions

  1. Inspect the truncated reply in the error for the actual bytes
  2. Ensure the command returns a string type (use the correct cmd type)

When it happens

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

Common situations: Match the Cmder type to the command's actual reply type.


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