owasp-amass/amass · error

invalid end port: %v

Error message

invalid end port: %v

What it means

convertPortRangeToSlice could not parse the end (upper bound) of a port range such as "80-443": strconv.Atoi on the substring after the '-' failed because it is not a valid integer. The start bound parsed fine, so the malformed portion is specifically the second number in the range string.

Source

Thrown at config/scope.go:145

	return nil
}

func convertPortRangeToSlice(portRange string) ([]int, error) {
	var ports []int

	parts := strings.Split(portRange, "-")
	if len(parts) != 2 {
		return nil, fmt.Errorf("invalid port range format")
	}

	start, err := strconv.Atoi(parts[0])
	if err != nil {
		return nil, fmt.Errorf("invalid start port: %v", err)
	}

	end, err := strconv.Atoi(parts[1])
	if err != nil {
		return nil, fmt.Errorf("invalid end port: %v", err)
	}

	for i := start; i <= end; i++ {
		ports = append(ports, i)
	}

	return ports, nil
}

// returns true is ports match default ports (80,443), otherwise return false
func portCheck(ports []int) bool {
	defaultPorts := []int{80, 443}

	portSet := make(map[int]struct{}, len(ports))
	for _, v := range ports {
		portSet[v] = struct{}{}
	}
	if len(portSet) > len(defaultPorts) {

View on GitHub (pinned to 79299dce87)

Solutions

  1. Correct the end value to a plain integer, e.g. '80-90'
  2. Trim trailing whitespace/newlines (quote YAML values to preserve intent cleanly)
  3. Check for letter-vs-digit typos (O vs 0, l vs 1)

Example fix

// before
ports: ["80-9O"]
// after
ports: ["80-90"]
Defensive patterns

Strategy: validation

Validate before calling

parts := strings.Split(s, "-"); if len(parts) == 2 { if _, err := strconv.Atoi(parts[1]); err != nil { return err } }

Prevention

When it happens

Trigger: A range like '80-ninety', '80-90 ' (trailing space/newline) is passed; strconv.Atoi on parts[1] fails.

Common situations: Trailing whitespace or CRLF at end of a YAML value, service names in the end position, typos like '80-9O' with letter O.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06). Data as JSON: /api/errors/9627740aef964926. Report an issue: GitHub.