{"id":"8757afe109cab046","repo":"docker/cli","slug":"service-is-already-attached-to-network-s","errorCode":null,"errorMessage":"service is already attached to network %s","messagePattern":"service is already attached to network (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/service/update.go","lineNumber":1345,"sourceCode":"\tfor _, nw := range specNetworks {\n\t\tif _, exists := idsToRemove[nw.Target]; exists {\n\t\t\tcontinue\n\t\t}\n\n\t\tnewNetworks = append(newNetworks, nw)\n\t\texistingNetworks[nw.Target] = struct{}{}\n\t}\n\n\tif flags.Changed(flagNetworkAdd) {\n\t\tvalues := flags.Lookup(flagNetworkAdd).Value.(*opts.NetworkOpt)\n\t\tnetworks := convertNetworks(*values)\n\t\tfor _, nw := range networks {\n\t\t\tnwID, err := resolveNetworkID(ctx, apiClient, nw.Target)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif _, exists := existingNetworks[nwID]; exists {\n\t\t\t\treturn fmt.Errorf(\"service is already attached to network %s\", nw.Target)\n\t\t\t}\n\t\t\tnw.Target = nwID\n\t\t\tnewNetworks = append(newNetworks, nw)\n\t\t\texistingNetworks[nw.Target] = struct{}{}\n\t\t}\n\t}\n\n\tsort.Slice(newNetworks, func(i, j int) bool {\n\t\treturn newNetworks[i].Target < newNetworks[j].Target\n\t})\n\n\tspec.TaskTemplate.Networks = newNetworks\n\treturn nil\n}\n\n// updateCredSpecConfig updates the value of the credential spec Config field\n// to the config ID if the credential spec has changed. it mutates the passed\n// spec. it does not handle the case where the credential spec specifies a","sourceCodeStart":1327,"sourceCodeEnd":1363,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/service/update.go#L1327-L1363","documentation":"Error \"service is already attached to network %s\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/service/update.go:1345 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}