probelabs/goreplay · error

need both src and target, colon-delimited (ex. /a:/b)

Error message

need both src and target, colon-delimited (ex. /a:/b)

What it means

Flag-value validation error raised by URLRewriteMap.Set (used by --http-rewrite-url) when the argument lacks a colon separating the source regexp from the target path, so no urlRewrite rule can be built.

Source

Thrown at http_modifier_settings.go:218

// Handling of --http-rewrite-url option
type urlRewrite struct {
	src    *regexp.Regexp
	target []byte
}

// URLRewriteMap holds regexp and data to modify URL
type URLRewriteMap []urlRewrite

func (r *URLRewriteMap) String() string {
	return fmt.Sprint(*r)
}

// Set method to implement flags.Value
func (r *URLRewriteMap) Set(value string) error {
	valArr := strings.SplitN(value, ":", 2)
	if len(valArr) < 2 {
		return errors.New("need both src and target, colon-delimited (ex. /a:/b)")
	}
	regexp, err := regexp.Compile(valArr[0])
	if err != nil {
		return err
	}
	*r = append(*r, urlRewrite{src: regexp, target: []byte(valArr[1])})
	return nil
}

// Handling of --http-rewrite-header option
type headerRewrite struct {
	header []byte
	src    *regexp.Regexp
	target []byte
}

// HeaderRewriteMap holds regexp and data to rewrite headers
type HeaderRewriteMap []headerRewrite

View on GitHub (pinned to 251e45abd2)

Solutions

  1. Provide 'src:target', e.g. --http-rewrite-url '/v1/app(.*)/v2/app$1'
  2. Ensure the colon is inside a quoted shell argument
  3. Remember the src part is a regexp compiled right after this check; fix regexp errors separately
Defensive patterns

Strategy: validation

When it happens

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