{"record":{"id":"038cbcf775d55388","repo":"kubernetes/kops","slug":"error-appending-tag-to-network-v","errorCode":null,"errorMessage":"Error appending tag to network: %v","messagePattern":"Error appending tag to network: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstacktasks/network.go","lineNumber":134,"sourceCode":"\nfunc (_ *Network) RenderOpenstack(t *openstack.OpenstackAPITarget, a, e, changes *Network) error {\n\tif a == nil {\n\t\tklog.V(2).Infof(\"Creating Network with name:%q\", fi.ValueOf(e.Name))\n\n\t\topt := networks.CreateOpts{\n\t\t\tName:                  fi.ValueOf(e.Name),\n\t\t\tAdminStateUp:          new(true),\n\t\t\tAvailabilityZoneHints: fi.StringSliceValue(e.AvailabilityZoneHints),\n\t\t}\n\n\t\tv, err := t.Cloud.CreateNetwork(opt)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error creating network: %v\", err)\n\t\t}\n\n\t\terr = t.Cloud.AppendTag(openstack.ResourceTypeNetwork, v.ID, fi.ValueOf(e.Tag))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error appending tag to network: %v\", err)\n\t\t}\n\n\t\te.ID = new(v.ID)\n\t\tklog.V(2).Infof(\"Creating a new Openstack network, id=%s\", v.ID)\n\t\treturn nil\n\t} else {\n\t\terr := t.Cloud.AppendTag(openstack.ResourceTypeNetwork, fi.ValueOf(a.ID), fi.ValueOf(changes.Tag))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error appending tag to network: %v\", err)\n\t\t}\n\t}\n\te.ID = a.ID\n\tklog.V(2).Infof(\"Using an existing Openstack network, id=%s\", fi.ValueOf(e.ID))\n\treturn nil\n}\n","sourceCodeStart":116,"sourceCodeEnd":150,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstacktasks/network.go#L116-L150","documentation":"After a network is successfully created, RenderOpenstack calls Cloud.AppendTag to stamp the cluster tag on the new Neutron network. If that tagging API call fails, the network is left created but untagged and kOps aborts the render with this wrapped error.","triggerScenarios":"Cloud.AppendTag(openstack.ResourceTypeNetwork, v.ID, tag) fails right after CreateNetwork succeeds: the network ID is fresh but the tag PUT is rejected (401/403, tag extension disabled in Neutron, transient 503, or tag string violating Neutron tag character rules).","commonSituations":"Older Neutron deployments without the default tagging extension enabled; Keystone token expiring mid-run; a tag value containing invalid characters set in the cluster spec; intermittent Neutron 503 during a large cluster create.","solutions":["Check the wrapped gophercloud error for the HTTP status of the tag PUT","Confirm the Neutron `tag` extension is enabled (`openstack extension list`) on the deployment","Verify the cluster Tag value contains only valid tag characters (no spaces/special chars)","Re-run `kops update cluster`: the network now exists and render will take the update path","Re-authenticate if the error was 401; check token TTL vs cluster update duration"],"exampleFix":"// before\ntag: \"my cluster tag\"\n// after\ntag: \"my-cluster-tag\" // Neutron tags disallow spaces","handlingStrategy":"retry","validationCode":"// ensure tag extension exists\nout, err := exec.Command(\"openstack\", \"extension\", \"list\", \"--tag\", \"tag\").Output()\nif err != nil || len(out) == 0 { /* tagging unsupported; skip or upgrade Neutron */ }\n// validate tag chars\nvalidTag := regexp.MustCompile(`^[\\w.\\-]+$`).MatchString(tag)","typeGuard":"func isValidNeutronTag(tag string) bool {\n\treturn len(tag) > 0 && len(tag) <= 255 && regexp.MustCompile(`^[\\w.\\-]+$`).MatchString(tag)\n}","tryCatchPattern":"err = t.Cloud.AppendTag(openstack.ResourceTypeNetwork, v.ID, tag)\nif err != nil {\n\tif isTransient(err) { // 5xx/timeout\n\t\treturn retryAfter(backoff) // network exists; safe to retry append\n\t}\n\treturn fmt.Errorf(\"Error appending tag to network: %v\", err)\n}","preventionTips":["Confirm the Neutron tag extension is enabled on your cloud","Use only word/dash/dot characters in cluster tags","Refresh tokens before long cluster updates to avoid mid-run 401"],"tags":["openstack","neutron","tagging","network"],"backgroundTag":"openstack-tag-extension-failure","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}