{"record":{"id":"f1034f89777a47d5","repo":"tsenart/vegeta","slug":"invalid-destination-address-expression-s-expec","errorCode":null,"errorMessage":"invalid destination address expression [%s], expected address:port","messagePattern":"invalid destination address expression \\[(.+?)\\], expected address:port","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"flags.go","lineNumber":201,"sourceCode":"\tif *c.addrMap == nil {\n\t\t*c.addrMap = make(map[string][]string)\n\t}\n\n\tparts := strings.Split(s, \":\")\n\tif len(parts) != 4 {\n\t\treturn fmt.Errorf(\"invalid -connect-to %q, expected format: %s\", s, connectToFormat)\n\t}\n\tsrcAddr := parts[0] + \":\" + parts[1]\n\tdstAddr := parts[2] + \":\" + parts[3]\n\n\t// Parse source address\n\tif _, _, err := net.SplitHostPort(srcAddr); err != nil {\n\t\treturn fmt.Errorf(\"invalid source address expression [%s], expected address:port\", srcAddr)\n\t}\n\n\t// Parse destination address\n\tif _, _, err := net.SplitHostPort(dstAddr); err != nil {\n\t\treturn fmt.Errorf(\"invalid destination address expression [%s], expected address:port\", dstAddr)\n\t}\n\n\t(*c.addrMap)[srcAddr] = append((*c.addrMap)[srcAddr], dstAddr)\n\n\treturn nil\n}\n","sourceCodeStart":183,"sourceCodeEnd":208,"githubUrl":"https://github.com/tsenart/vegeta/blob/cf5811269046c672a604b1eb352204d30f16ae4a/flags.go#L183-L208","documentation":"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.","triggerScenarios":"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.","commonSituations":"Pointing at an IPv6 target without brackets; typos or empty fields in the second half; templated destination values that resolve to blank.","solutions":["Write the destination as a valid host:port, e.g. -connect-to='example.com:80:127.0.0.1:8080'.","Bracket IPv6 literals: '[::1]:8080'.","Ensure the destination host is non-empty with exactly one port.","Validate both halves with net.SplitHostPort before invoking vegeta."],"exampleFix":"// before\n-connect-to='example.com:80:::8080'\n// after\n-connect-to='example.com:80:[::1]:8080'","handlingStrategy":"validation","validationCode":"func validDstAddr(dst string) bool {\n\t_, _, err := net.SplitHostPort(dst)\n\treturn err == nil\n}\n// apply to the second host:port half of -connect-to","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure non-empty host and one port in the destination half.","Bracket IPv6 literals.","Validate both halves before launching vegeta.","Log the assembled -connect-to value for debugging."],"tags":["cli","network","address-parsing"],"backgroundTag":"invalid-address-format","analyzedSha":"cf5811269046c672a604b1eb352204d30f16ae4a","analyzedAt":"2026-08-31T11:04:20.464Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}