{"id":"b87230a2ca7882b1","repo":"docker/cli","slug":"network-q-is-specified-multiple-times","errorCode":null,"errorMessage":"network %q is specified multiple times","messagePattern":"network %q is specified multiple times","errorType":"validation","errorClass":"invalidParameter","httpStatus":null,"severity":"error","filePath":"cli/command/container/opts.go","lineNumber":791,"sourceCode":"\t\t} else {\n\t\t\thasNonUserDefined = true\n\t\t}\n\t\tif i == 0 {\n\t\t\t// The first network corresponds with what was previously the \"only\"\n\t\t\t// network, and what would be used when using the non-advanced syntax\n\t\t\t// `--network-alias`, `--link`, `--ip`, `--ip6`, and `--link-local-ip`\n\t\t\t// are set on this network, to preserve backward compatibility with\n\t\t\t// the non-advanced notation\n\t\t\tif err := applyContainerOptions(&n, copts); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tep, err := parseNetworkAttachmentOpt(n)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif _, ok := endpoints[n.Target]; ok {\n\t\t\treturn nil, invalidParameter(fmt.Errorf(\"network %q is specified multiple times\", n.Target))\n\t\t}\n\n\t\t// For backward compatibility: if no custom options are provided for the network,\n\t\t// and only a single network is specified, omit the endpoint-configuration\n\t\t// on the client (the daemon will still create it when creating the container)\n\t\tif i == 0 && len(copts.netMode.Value()) == 1 {\n\t\t\tif ep == nil || reflect.ValueOf(*ep).IsZero() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tendpoints[n.Target] = ep\n\t}\n\tif hasUserDefined && hasNonUserDefined {\n\t\treturn nil, invalidParameter(errors.New(\"conflicting options: cannot attach both user-defined and non-user-defined network-modes\"))\n\t}\n\treturn endpoints, nil\n}\n","sourceCodeStart":773,"sourceCodeEnd":809,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/container/opts.go#L773-L809","documentation":"Error \"network %q is specified multiple times\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/container/opts.go:791 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}