{"record":{"id":"d51fbd2994a38d55","repo":"caddyserver/caddy","slug":"port-d-is-out-of-range","errorCode":null,"errorMessage":"port %d is out of range","messagePattern":"port (.+?) is out of range","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"caddyconfig/httpcaddyfile/addresses.go","lineNumber":416,"sourceCode":"\t\t\thost, port, err = net.SplitHostPort(hostSplit[0] + \":\")\n\t\t\tif err != nil {\n\t\t\t\thost = hostSplit[0]\n\t\t\t}\n\t\t}\n\t\ta.Host = host\n\t\ta.Port = port\n\t}\n\tif len(hostSplit) == 2 {\n\t\t// all that remains is the path\n\t\ta.Path = \"/\" + hostSplit[1]\n\t}\n\n\t// make sure port is valid\n\tif a.Port != \"\" {\n\t\tif portNum, err := strconv.Atoi(a.Port); err != nil {\n\t\t\treturn Address{}, fmt.Errorf(\"invalid port '%s': %v\", a.Port, err)\n\t\t} else if portNum < 0 || portNum > 65535 {\n\t\t\treturn Address{}, fmt.Errorf(\"port %d is out of range\", portNum)\n\t\t}\n\t}\n\n\treturn a, nil\n}\n\n// String returns a human-readable form of a. It will\n// be a cleaned-up and filled-out URL string.\nfunc (a Address) String() string {\n\tif a.Host == \"\" && a.Port == \"\" {\n\t\treturn \"\"\n\t}\n\tscheme := a.Scheme\n\tif scheme == \"\" {\n\t\tif a.Port == strconv.Itoa(certmagic.HTTPSPort) {\n\t\t\tscheme = \"https\"\n\t\t} else {\n\t\t\tscheme = \"http\"","sourceCodeStart":398,"sourceCodeEnd":434,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/caddyconfig/httpcaddyfile/addresses.go#L398-L434","documentation":"Error \"port %d is out of range\" thrown in caddyserver/caddy.","triggerScenarios":"Thrown at caddyconfig/httpcaddyfile/addresses.go:416 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Specify a port within the valid range 0-65535.","Check the address for a typo such as an extra digit in the port."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}