owasp-amass/amass · error

invalid start port: %v

Error message

invalid start port: %v

What it means

convertPortRangeToSlice could not parse the start (lower bound) of a port range such as "80-443": strconv.Atoi on the substring before the '-' failed because it is not a valid integer (letters, empty, or out-of-range digits). The format itself already passed the two-part split check, so only the numeric value is at fault.

Source

Thrown at config/scope.go:140

		default:
			return fmt.Errorf("unsupported port type: %T", p)
		}
	}

	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}

View on GitHub (pinned to 79299dce87)

Solutions

  1. Correct the start value to a plain integer, e.g. '80-90'
  2. Trim spaces and invisible characters from the range string
  3. Verify digits are ASCII (not full-width Unicode)

Example fix

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

Strategy: validation

Validate before calling

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

Prevention

When it happens

Trigger: A range like 'http-90', ' 80-90' (leading space), or 'o80-90' is passed; strconv.Atoi on parts[0] fails.

Common situations: Whitespace inside range strings from hand-edited YAML, alphabetic typos, full-width digits, or BOM characters at the start of the value.

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/2ac7cf5887170d5f. Report an issue: GitHub.