go-redis/redis · error

redis: can't parse float reply: %.100q

Error message

redis: can't parse float reply: %.100q

What it means

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

Source

Thrown at internal/proto/reader.go:563

func (r *Reader) ReadFloat() (float64, error) {
	line, err := r.ReadLine()
	if err != nil {
		return 0, err
	}
	switch line[0] {
	case RespFloat:
		return r.readFloat(line)
	case RespStatus:
		return strconv.ParseFloat(util.BytesToString(line[1:]), 64)
	case RespString:
		s, err := r.readStringReply(line)
		if err != nil {
			return 0, err
		}
		return strconv.ParseFloat(s, 64)
	}
	return 0, fmt.Errorf("redis: can't parse float reply: %.100q", line)
}

// ReadStringInto reads a string-typed reply directly into buf, avoiding the
// per-call allocation that ReadString incurs. It returns the number of bytes
// written to buf.
//
// Supported reply types:
//   - $<n>\r\n<payload>\r\n  bulk string (the GET path; payload is read
//     straight into buf via bufio.Reader — for payloads larger than the
//     bufio buffer this is effectively zero-copy from the socket)
//   - +<status>\r\n          simple string, copied from the header line
//   - :<int>\r\n             integer, copied as its ASCII representation
//   - ,<float>\r\n           float, copied as its ASCII representation
//
// Errors, nil, push notifications, and RESP3 attributes are intercepted
// by ReadLine and surfaced through err. RESP3 verbatim strings
// (=<n>\r\n<txt:payload>\r\n) are intentionally not handled — they are
// never returned by GET-family commands, and including them re-introduces

View on GitHub (pinned to 36d97525cd)

Solutions

  1. Inspect the quoted reply; the float field is malformed (or 'inf'/'nan' where unsupported)
  2. Reconnect to resync the stream

When it happens

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

Common situations: Validate float strings with strconv before use and treat parse errors as conn-fatal.


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