{"record":{"id":"4d955a297ad03575","repo":"owasp-amass/amass","slug":"unsupported-port-type-t","errorCode":null,"errorMessage":"unsupported port type: %T","messagePattern":"unsupported port type: %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/scope.go","lineNumber":123,"sourceCode":"\t\t\ts.Ports = append(s.Ports, p)\n\t\tcase string: // If it's a string, check if it's a range or a single port\n\t\t\tif strings.Contains(p, \"-\") {\n\t\t\t\t// Handle port range\n\t\t\t\tportRange, err := convertPortRangeToSlice(p)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\ts.Ports = append(s.Ports, portRange...)\n\t\t\t} else {\n\t\t\t\t// Handle single port string\n\t\t\t\tportNum, err := strconv.Atoi(p)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"invalid port string: %v\", err)\n\t\t\t\t}\n\t\t\t\ts.Ports = append(s.Ports, portNum)\n\t\t\t}\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unsupported port type: %T\", p)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc convertPortRangeToSlice(portRange string) ([]int, error) {\n\tvar ports []int\n\n\tparts := strings.Split(portRange, \"-\")\n\tif len(parts) != 2 {\n\t\treturn nil, fmt.Errorf(\"invalid port range format\")\n\t}\n\n\tstart, err := strconv.Atoi(parts[0])\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid start port: %v\", err)\n\t}","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/config/scope.go#L105-L141","documentation":"parsePorts switches on the dynamic type of each port entry and only supports string and int. Any other type (float64 from JSON, nested list, bool, etc.) hits the default case and returns this error naming the Go type via %T.","triggerScenarios":"A Ports entry in the scope settings is a type other than string or int — commonly float64 when the config was decoded from JSON/YAML (numbers unmarshal as float64 into interface{}), or a nested slice.","commonSituations":"YAML/JSON config with ports written as 80.0 or a nested list; programmatic config passing []string instead of []interface{} of strings/ints.","solutions":["Write port values as integers (80) not decimals (80.0) in the config file","Flatten nested lists so each entry is a scalar string or int","When building options in Go, use int or string element types inside the interface{} slice"],"exampleFix":"// before (yaml)\nports: [80.0, [443]]\n// after (yaml)\nports: [80, 443]","handlingStrategy":"type-guard","validationCode":"for _, p := range ports { switch p.(type) { case string, int: default: return fmt.Errorf(\"port entry must be string or int, got %T\", p) } }","typeGuard":"func isSupportedPortType(v interface{}) bool { switch v.(type) { case string, int: return true }; return false }","tryCatchPattern":null,"preventionTips":["Write ports as integers, not decimals","Avoid nested lists in port config","Remember JSON/YAML numbers can decode as float64 into interface{}","Validate port entry types before LoadSettings"],"tags":["config","ports","type-mismatch"],"backgroundTag":"unsupported-config-value","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}