probelabs/goreplay · error

Expected `Key: Value`

Error message

Expected `Key: Value`

What it means

Flag-value validation error raised by HTTPHeaders.Set (used by --http-set-header) when the argument cannot be split into exactly two colon-separated parts, so no header name/value pair can be appended.

Source

Thrown at http_modifier_settings.go:143

// 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)
}

// Set method to implement flags.Value
func (h *HTTPHeaders) Set(value string) error {
	v := strings.SplitN(value, ":", 2)
	if len(v) != 2 {
		return errors.New("Expected `Key: Value`")
	}

	header := httpHeader{
		strings.TrimSpace(v[0]),
		strings.TrimSpace(v[1]),
	}

	*h = append(*h, header)
	return nil
}

// Handling of --http-set-param option
type httpParam struct {
	Name  []byte
	Value []byte
}

// HTTPParams filters for --http-set-param

View on GitHub (pinned to 251e45abd2)

Solutions

  1. Format the flag as 'Header: Value', e.g. --http-set-header 'X-Forwarded-For: 1.2.3.4'
  2. Remember only the first colon splits the pair; values may contain further colons
  3. Check shell quoting so the whole pair is one argument
Defensive patterns

Strategy: validation

When it happens

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