tsenart/vegeta · error

invalid destination address expression [%s], expected addres

Error message

invalid destination address expression [%s], expected address:port

What it means

This is the destination-half validation of -connect-to: after the source half passes, vegeta checks parts[2]+":"+parts[3] with net.SplitHostPort and rejects malformed destination host:port expressions with this error.

Source

Thrown at flags.go:201

	if *c.addrMap == nil {
		*c.addrMap = make(map[string][]string)
	}

	parts := strings.Split(s, ":")
	if len(parts) != 4 {
		return fmt.Errorf("invalid -connect-to %q, expected format: %s", s, connectToFormat)
	}
	srcAddr := parts[0] + ":" + parts[1]
	dstAddr := parts[2] + ":" + parts[3]

	// Parse source address
	if _, _, err := net.SplitHostPort(srcAddr); err != nil {
		return fmt.Errorf("invalid source address expression [%s], expected address:port", srcAddr)
	}

	// Parse destination address
	if _, _, err := net.SplitHostPort(dstAddr); err != nil {
		return fmt.Errorf("invalid destination address expression [%s], expected address:port", dstAddr)
	}

	(*c.addrMap)[srcAddr] = append((*c.addrMap)[srcAddr], dstAddr)

	return nil
}

View on GitHub (pinned to cf58112690)

Solutions

  1. Write the destination as a valid host:port, e.g. -connect-to='example.com:80:127.0.0.1:8080'.
  2. Bracket IPv6 literals: '[::1]:8080'.
  3. Ensure the destination host is non-empty with exactly one port.
  4. Validate both halves with net.SplitHostPort before invoking vegeta.

Example fix

// before
-connect-to='example.com:80:::8080'
// after
-connect-to='example.com:80:[::1]:8080'
Defensive patterns

Strategy: validation

Validate before calling

func validDstAddr(dst string) bool {
	_, _, err := net.SplitHostPort(dst)
	return err == nil
}
// apply to the second host:port half of -connect-to

Prevention

When it happens

Trigger: Calling ConnectTo.Set where the destination half (3rd and 4th colon-separated fields) fails net.SplitHostPort — e.g. empty host, too many colons, or unbracketed IPv6.

Common situations: Pointing at an IPv6 target without brackets; typos or empty fields in the second half; templated destination values that resolve to blank.

Related errors


AI-assisted analysis of tsenart/vegeta@cf58112690 (2026-08-31). Data as JSON: /api/errors/f1034f89777a47d5. Report an issue: GitHub.