redis/go-redis · error

redis: invalid %s boolean: expected true/false/1/0 or an emp

Error message

redis: invalid %s boolean: expected true/false/1/0 or an empty string, got %q

What it means

Error "redis: invalid %s boolean: expected true/false/1/0 or an empty string, got %q" thrown in redis/go-redis.

Source

Thrown at options.go:895

			return -1
		}
		return dur
	}
	if o.err == nil {
		o.err = fmt.Errorf("redis: invalid %s duration: %w", name, err)
	}
	return 0
}

func (o *queryOptions) bool(name string) bool {
	switch s := o.string(name); s {
	case "true", "1":
		return true
	case "false", "0", "":
		return false
	default:
		if o.err == nil {
			o.err = fmt.Errorf("redis: invalid %s boolean: expected true/false/1/0 or an empty string, got %q", name, s)
		}
		return false
	}
}

func (o *queryOptions) remaining() []string {
	if len(o.q) == 0 {
		return nil
	}
	keys := slices.Collect(maps.Keys(o.q))
	slices.Sort(keys)
	return keys
}

// setupConnParams converts query parameters in u to option value in o.
func setupConnParams(u *url.URL, o *Options) (*Options, error) {
	q := queryOptions{q: u.Query()}

View on GitHub (pinned to c5cad058c7)

When it happens

Trigger: Thrown at options.go:895 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of redis/go-redis@c5cad058c7 (2026-09-01). Data as JSON: /api/errors/c7c8ba4c93a7cb26. Report an issue: GitHub.