{"record":{"id":"73bc410accdc918c","repo":"hashicorp/nomad","slug":"port-q-cannot-be-mapped-to-a-port-d-greater-th","errorCode":null,"errorMessage":"Port %q cannot be mapped to a port (%d) greater than %d","messagePattern":"Port %q cannot be mapped to a port \\((.+?)\\) greater than (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/structs.go","lineNumber":7370,"sourceCode":"\t\t\t\tif other, ok := staticPorts[port.Value]; ok {\n\t\t\t\t\tif !port.IgnoreCollision {\n\t\t\t\t\t\terr := fmt.Errorf(\"Static port %d already reserved by %s\", port.Value, other)\n\t\t\t\t\t\tmErr.Errors = append(mErr.Errors, err)\n\t\t\t\t\t}\n\t\t\t\t} else if port.Value > math.MaxUint16 {\n\t\t\t\t\terr := fmt.Errorf(\"Port %s (%d) cannot be greater than %d\", port.Label, port.Value, math.MaxUint16)\n\t\t\t\t\tmErr.Errors = append(mErr.Errors, err)\n\t\t\t\t} else {\n\t\t\t\t\tstaticPorts[port.Value] = fmt.Sprintf(\"taskgroup network:%s\", port.Label)\n\t\t\t\t\tstaticPortsIndex[hostNetwork] = staticPorts\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif port.To < -1 {\n\t\t\t\terr := fmt.Errorf(\"Port %q cannot be mapped to negative value %d\", port.Label, port.To)\n\t\t\t\tmErr.Errors = append(mErr.Errors, err)\n\t\t\t} else if port.To > math.MaxUint16 {\n\t\t\t\terr := fmt.Errorf(\"Port %q cannot be mapped to a port (%d) greater than %d\", port.Label, port.To, math.MaxUint16)\n\t\t\t\tmErr.Errors = append(mErr.Errors, err)\n\t\t\t}\n\n\t\t\tif port.IgnoreCollision && !(net.Mode == \"\" || net.Mode == \"host\") {\n\t\t\t\terr := fmt.Errorf(\"Port %q collision may not be ignored on non-host network mode %q\", port.Label, net.Mode)\n\t\t\t\tmErr.Errors = append(mErr.Errors, err)\n\t\t\t}\n\t\t}\n\t\t// Validate the cniArgs in each network resource. Make sure there are no duplicate Args in\n\t\t// different network resources or invalid characters (;) in key or value ;)\n\t\tif net.CNI != nil {\n\t\t\tfor k, v := range net.CNI.Args {\n\t\t\t\tif cniArgKeys.Contains(k) {\n\t\t\t\t\terr := fmt.Errorf(\"duplicate CNI arg %q\", k)\n\t\t\t\t\tmErr.Errors = append(mErr.Errors, err)\n\t\t\t\t} else {\n\t\t\t\t\tcniArgKeys.Insert(k)\n\t\t\t\t}","sourceCodeStart":7352,"sourceCodeEnd":7388,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L7352-L7388","documentation":"TaskGroup network validation: a port's 'to' destination exceeded 65535 (math.MaxUint16) and is not a representable port; the label and value identify the offending mapping.","triggerScenarios":"Thrown at nomad/structs/structs.go:7370 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the to value to a port between 0 and 65535"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}