{"record":{"id":"275da9fedb9e7bcf","repo":"hashicorp/nomad","slug":"port-q-collision-may-not-be-ignored-on-non-host-n","errorCode":null,"errorMessage":"Port %q collision may not be ignored on non-host network mode %q","messagePattern":"Port %q collision may not be ignored on non-host network mode %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/structs.go","lineNumber":7375,"sourceCode":"\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}\n\t\t\t\t// CNI_ARGS is a \";\"-separated string of \"key=val\", so a \";\"\n\t\t\t\t// in either key or val would confuse plugins (or libraries)\n\t\t\t\t// that parse that string.\n\t\t\t\t// Pre-validating this here protects job authors from submitting\n\t\t\t\t// a job that will most likely error later on the client anyway.","sourceCodeStart":7357,"sourceCodeEnd":7393,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L7357-L7393","documentation":"TaskGroup network validation: ignore_collision was set on a port while the network mode is not \"host\". Port collision ignoring relies on host-network semantics, so it is rejected for bridge and other non-host modes.","triggerScenarios":"Thrown at nomad/structs/structs.go:7375 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove ignore_collision from the port","Switch the network mode to host if collision ignoring is required"],"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"}