redis/go-redis · warning

invalid execution_time format: %v

Error message

invalid execution_time format: %v

What it means

The FT.HYBRID parser reads the optional "execution_time" field as a string (parsed as float) or a numeric float64/int64. If it is a string that fails strconv.ParseFloat, this error is returned wrapping the parse error. Any other type is silently ignored (execution time stays 0), so this error specifically means the time string was malformed.

Source

Thrown at search_commands.go:3137

	}
	if ok {
		warnings = make([]string, 0, len(warningsData))
		for _, w := range warningsData {
			if ws, ok := w.(string); ok {
				warnings = append(warnings, ws)
			}
		}
	}

	// Parse execution time (optional field)
	var executionTime float64
	if execTimeVal, exists := resultMap["execution_time"]; exists {
		switch v := execTimeVal.(type) {
		case string:
			var err error
			executionTime, err = strconv.ParseFloat(v, 64)
			if err != nil {
				return FTHybridResult{}, nil, fmt.Errorf("invalid execution_time format: %v", err)
			}
		case float64:
			executionTime = v
		case int64:
			executionTime = float64(v)
		}
	}

	return FTHybridResult{
		TotalResults:  int(totalResults),
		Results:       results,
		Warnings:      warnings,
		ExecutionTime: executionTime,
	}, nil, nil
}

func (cmd *FTHybridCmd) readReply(rd *proto.Reader) (err error) {
	readType, err := rd.PeekReplyType()

View on GitHub (pinned to c5cad058c7)

Solutions

  1. Upgrade go-redis/server so the execution_time string format matches (plain seconds float)
  2. Strip units before the reply reaches the client if a proxy adds them
  3. Set execution_time as float64 in test fixtures
  4. Ignore-safe: if only diagnostics matter, strip the field via a ProcessHook

Example fix

// before (fixture)
"execution_time": "1.23ms"
// after
"execution_time": "1.23"
Defensive patterns

Strategy: try-catch

Try / catch

res, _, err := hybridCmd.Result()
if err != nil {
    if strings.Contains(err.Error(), "invalid execution_time format") {
        // non-fatal: retry once without relying on diagnostics, or log and degrade
        log.Warn("malformed execution_time in FT.HYBRID reply")
        return runHybridIgnoringDiagnostics(ctx)
    }
    return err
}

Prevention

When it happens

Trigger: Calling FTHybrid when the server/proxy returns "execution_time" as a non-numeric string (e.g. "" or a formatted string like "1.2ms" instead of "1.2").

Common situations: Server builds that format execution time with units; proxies stringifying values; test fixtures with realistic-looking but unparsable strings.

Related errors


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