probelabs/goreplay · error

Value should be percent and contain '%'

Error message

Value should be percent and contain '%'

What it means

Flag-value validation error raised by HTTPHashFilters.Set when the value after the colon contains neither '%' (current format) nor '/' (deprecated fraction format), so no percentage can be parsed into hashFilter.percent.

Source

Thrown at http_modifier_settings.go:118

	f := hashFilter{name: []byte(valArr[0])}

	val := strings.TrimSpace(valArr[1])

	if strings.Contains(val, "%") {
		p, _ := strconv.ParseInt(val[:len(val)-1], 0, 0)
		f.percent = uint32(p)
	} else if strings.Contains(val, "/") {
		// DEPRECATED format
		var num, den uint64

		fracArr := strings.Split(val, "/")
		num, _ = strconv.ParseUint(fracArr[0], 10, 64)
		den, _ = strconv.ParseUint(fracArr[1], 10, 64)

		f.percent = uint32((float64(num) / float64(den)) * 100)
	} else {
		return errors.New("Value should be percent and contain '%'")
	}

	*h = append(*h, f)

	return nil
}

// Handling of --http-set-header option
type httpHeader struct {
	Name  string
	Value string
}

// HTTPHeaders is a slice of headers that must appended
type HTTPHeaders []httpHeader

func (h *HTTPHeaders) String() string {
	return fmt.Sprint(*h)

View on GitHub (pinned to 251e45abd2)

Solutions

  1. Append a percent sign: 'user_id:50%' instead of 'user_id:50'
  2. Use the legacy fraction form '1/2' only if intentionally relying on the deprecated format
  3. Validate the flag value in scripts before launching gor
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at http_modifier_settings.go:118 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of probelabs/goreplay@251e45abd2 (2026-09-02). Data as JSON: /api/errors/b026064dd3995313. Report an issue: GitHub.