{"record":{"id":"de6aff12056e54c1","repo":"docker/cli","slug":"invalid-gw-priority-s-w","errorCode":null,"errorMessage":"invalid gw-priority (%s): %w","messagePattern":"invalid gw-priority \\((.+?)\\): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"opts/network.go","lineNumber":107,"sourceCode":"\t\t\t\t}\n\t\t\t\tnetOpt.LinkLocalIPs = append(netOpt.LinkLocalIPs, a)\n\t\t\tcase driverOpt:\n\t\t\t\tkey, val, err = parseDriverOpt(val)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif netOpt.DriverOpts == nil {\n\t\t\t\t\tnetOpt.DriverOpts = make(map[string]string)\n\t\t\t\t}\n\t\t\t\tnetOpt.DriverOpts[key] = val\n\t\t\tcase gwPriorityOpt:\n\t\t\t\tnetOpt.GwPriority, err = strconv.Atoi(val)\n\t\t\t\tif err != nil {\n\t\t\t\t\tvar numErr *strconv.NumError\n\t\t\t\t\tif errors.As(err, &numErr) {\n\t\t\t\t\t\terr = numErr.Err\n\t\t\t\t\t}\n\t\t\t\t\treturn fmt.Errorf(\"invalid gw-priority (%s): %w\", val, err)\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\treturn errors.New(\"invalid field key \" + key)\n\t\t\t}\n\t\t}\n\t\tif len(netOpt.Target) == 0 {\n\t\t\treturn errors.New(\"network name/id is not specified\")\n\t\t}\n\t} else {\n\t\tnetOpt.Target = value\n\t}\n\tn.options = append(n.options, netOpt)\n\treturn nil\n}\n\n// Type returns the type of this option\nfunc (*NetworkOpt) Type() string {\n\treturn \"network\"","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/opts/network.go#L89-L125","documentation":"Returned by NetworkOpt.Set (opts/network.go:107) when the `gw-priority` field's value fails strconv.Atoi. The underlying error is unwrapped from *strconv.NumError and wrapped with the offending value, exposing the concrete parse failure (typically ErrSyntax for non-numeric input or ErrRange for out-of-int-range). gw-priority sets the gateway priority for the network attachment.","triggerScenarios":"Passing `gw-priority=high`, `gw-priority=1.5`, `gw-priority=` (empty — though that hits Atoi with empty string => ErrSyntax), or a value exceeding int range on the host.","commonSituations":"Using a descriptive word instead of an integer, decimal priority, or copy-paste from a doc that used a non-numeric placeholder.","solutions":["Provide an integer: gw-priority=10.","Remove the field if you don't need to set gateway priority (it defaults to 0).","Avoid decimals and descriptive strings; priority is a plain integer ranking."],"exampleFix":"// before\n--network \"name=mynet,gw-priority=high\"\n\n// after\n--network \"name=mynet,gw-priority=10\"","handlingStrategy":"validation","validationCode":"func validateGwPriority(v string) error {\n    if _, err := strconv.Atoi(v); err != nil {\n        return fmt.Errorf(\"gw-priority must be an integer, got %q\", v)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if err := n.Set(spec); err != nil {\n    return fmt.Errorf(\"network %q: %w\", spec, err)\n}","preventionTips":["Treat gw-priority as a plain integer; reject decimals and words in your UI.","Omit the field when you don't need to rank gateways.","Document that higher = preferred."],"tags":["network","docker","gw-priority","parse","validation"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}