probelabs/goreplay · error

need both header and value, colon-delimited (ex. user_id:^16

Error message

need both header and value, colon-delimited (ex. user_id:^169$)

What it means

Flag-value validation error raised by HTTPHeaderFilters.Set (used by --http-allow-header/--http-disallow-header) when the user's flag argument has no colon, so it cannot be split into a header name and a regexp value; such an input can never become a headerFilter.

Source

Thrown at http_modifier_settings.go:44

// Handling of --http-allow-header, --http-disallow-header options
type headerFilter struct {
	name   []byte
	regexp *regexp.Regexp
}

// HTTPHeaderFilters holds list of headers and their regexps
type HTTPHeaderFilters []headerFilter

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

// Set method to implement flags.Value
func (h *HTTPHeaderFilters) Set(value string) error {
	valArr := strings.SplitN(value, ":", 2)
	if len(valArr) < 2 {
		return errors.New("need both header and value, colon-delimited (ex. user_id:^169$)")
	}
	val := strings.TrimSpace(valArr[1])
	r, err := regexp.Compile(val)
	if err != nil {
		return err
	}

	*h = append(*h, headerFilter{name: []byte(valArr[0]), regexp: r})

	return nil
}

// Handling of --http-basic-auth-filter option
type basicAuthFilter struct {
	regexp *regexp.Regexp
}

// HTTPHeaderBasicAuthFilters holds list of regxp to match basic Auth header values

View on GitHub (pinned to 251e45abd2)

Solutions

  1. Pass the flag as Header:Value with a colon, e.g. --http-allow-header 'user_id:^169$'
  2. Quote the argument in the shell so the colon is not eaten by the tool wrapping the command
  3. Check the flag parsing call site for a splitter that strips colons before Set receives the value
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at http_modifier_settings.go:44 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/d72017b841e4097c. Report an issue: GitHub.