{"record":{"id":"3c52f057cb4103cb","repo":"tailscale/tailscale","slug":"failed-to-get-object-w","errorCode":null,"errorMessage":"failed to get object: %w","messagePattern":"failed to get object: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/k8s-operator/sts.go","lineNumber":1215,"sourceCode":"\t\texisting.SetName(obj.GetName())\n\t\texisting.SetNamespace(obj.GetNamespace())\n\t\terr = c.Get(ctx, client.ObjectKeyFromObject(obj), existing)\n\t} else {\n\t\texisting, err = getSingleObject[T, O](ctx, c, ns, obj.GetLabels())\n\t}\n\tif err == nil && existing != nil {\n\t\tif update != nil {\n\t\t\tif err := update(existing); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif err := c.Update(ctx, existing); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\treturn existing, nil\n\t}\n\tif err != nil && !apierrors.IsNotFound(err) {\n\t\treturn nil, fmt.Errorf(\"failed to get object: %w\", err)\n\t}\n\tif err := c.Create(ctx, obj); err != nil {\n\t\treturn nil, err\n\t}\n\treturn obj, nil\n}\n\n// createOrUpdate adds obj to the k8s cluster, unless the object already exists,\n// in which case update is called to make changes to it. If update is nil, the\n// existing object is returned unmodified.\n//\n// obj is looked up by its Name and Namespace if Name is set, otherwise it's\n// looked up by labels.\nfunc createOrUpdate[T any, O ptrObject[T]](ctx context.Context, c client.Client, ns string, obj O, update func(O)) (O, error) {\n\treturn createOrMaybeUpdate(ctx, c, ns, obj, func(o O) error {\n\t\tif update != nil {\n\t\t\tupdate(o)\n\t\t}","sourceCodeStart":1197,"sourceCodeEnd":1233,"githubUrl":"https://github.com/tailscale/tailscale/blob/cfe32b8be6a33f8e24fbc369cbfbf7c729d9e042/cmd/k8s-operator/sts.go#L1197-L1233","documentation":"Error \"failed to get object: %w\" thrown in tailscale/tailscale.","triggerScenarios":"Thrown at cmd/k8s-operator/sts.go:1215 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"cfe32b8be6a33f8e24fbc369cbfbf7c729d9e042","analyzedAt":"2026-08-15T19:58:31.583Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}