{"record":{"id":"b7223efdbb71bea1","repo":"kubernetes/kops","slug":"error-appending-tag-s-v","errorCode":null,"errorMessage":"error appending tag %s: %v","messagePattern":"error appending tag (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/openstack/network.go","lineNumber":39,"sourceCode":"\t\"fmt\"\n\n\t\"github.com/gophercloud/gophercloud/v2/openstack/networking/v2/extensions/attributestags\"\n\t\"github.com/gophercloud/gophercloud/v2/openstack/networking/v2/extensions/external\"\n\t\"github.com/gophercloud/gophercloud/v2/openstack/networking/v2/networks\"\n\t\"github.com/gophercloud/gophercloud/v2/pagination\"\n\t\"k8s.io/apimachinery/pkg/util/wait\"\n\t\"k8s.io/kops/util/pkg/vfs\"\n)\n\nfunc (c *openstackCloud) AppendTag(resource string, id string, tag string) error {\n\treturn appendTag(c, resource, id, tag)\n}\n\nfunc appendTag(c OpenstackCloud, resource string, id string, tag string) error {\n\tdone, err := vfs.RetryWithBackoff(readBackoff, func() (bool, error) {\n\t\terr := attributestags.Add(context.TODO(), c.NetworkingClient(), resource, id, tag).ExtractErr()\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"error appending tag %s: %v\", tag, err)\n\t\t}\n\t\treturn true, nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t} else if done {\n\t\treturn nil\n\t} else {\n\t\treturn wait.ErrWaitTimeout\n\t}\n}\n\nfunc (c *openstackCloud) DeleteTag(resource string, id string, tag string) error {\n\treturn deleteTag(c, resource, id, tag)\n}\n\nfunc deleteTag(c OpenstackCloud, resource string, id string, tag string) error {\n\tdone, err := vfs.RetryWithBackoff(readBackoff, func() (bool, error) {","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/openstack/network.go#L21-L57","documentation":"Wraps a failure of the Neutron attributestags.Add call used to attach a tag to a resource (e.g. network, subnet, router, port). The call is retried with backoff; if it keeps failing the wrapped error is returned.","triggerScenarios":"NetworkingClient request to add a tag fails: resource ID not found, 403 auth/policy denial, or network outage to the Neutron endpoint.","commonSituations":"Tagging a port/subnet that was deleted concurrently; project lacking Neutron tag permissions; Keystone token expired; wrong resource type string passed to appendTag.","solutions":["Confirm the resource ID and resource type are correct and the resource still exists","Check credentials/policy allow tag operations on the resource","Inspect embedded %v for 404/403 to pinpoint cause","Rely on the built-in backoff retry for transient network errors"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// ensure resource exists before tagging\n_, err := osClient.NetworkingV2().Get(resourceID) // appropriate Get per resource type\n// proceed only if err == nil","typeGuard":null,"tryCatchPattern":"if err := appendTag(c, \"networks\", id, tag); err != nil {\n    var gerr gophercloud.ErrUnexpectedResponseCode\n    if errors.As(err, &gerr) && gerr.Actual == 404 {\n        return nil // resource gone; skip tagging\n    }\n    return err\n}","preventionTips":["Confirm resource IDs exist before tagging","Ensure the project role includes Neutron tag operations","Watch for token expiry in long-running applies; re-authenticate","Treat 404 on tag ops as benign during teardown"],"tags":["openstack","neutron","tags"],"backgroundTag":"openstack-api-error","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"}