{"record":{"id":"777fd13def421b61","repo":"tailscale/tailscale","slug":"error-creating-rolebinding-w","errorCode":null,"errorMessage":"error creating RoleBinding: %w","messagePattern":"error creating RoleBinding: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/k8s-operator/tsrecorder.go","lineNumber":233,"sourceCode":"\trole := tsrRole(tsr, r.tsNamespace)\n\t_, err = createOrUpdate(ctx, r.Client, r.tsNamespace, role, func(r *rbacv1.Role) {\n\t\tr.ObjectMeta.Labels = role.ObjectMeta.Labels\n\t\tr.ObjectMeta.Annotations = role.ObjectMeta.Annotations\n\t\tr.Rules = role.Rules\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating Role: %w\", err)\n\t}\n\n\troleBinding := tsrRoleBinding(tsr, r.tsNamespace)\n\t_, err = createOrUpdate(ctx, r.Client, r.tsNamespace, roleBinding, func(r *rbacv1.RoleBinding) {\n\t\tr.ObjectMeta.Labels = roleBinding.ObjectMeta.Labels\n\t\tr.ObjectMeta.Annotations = roleBinding.ObjectMeta.Annotations\n\t\tr.RoleRef = roleBinding.RoleRef\n\t\tr.Subjects = roleBinding.Subjects\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating RoleBinding: %w\", err)\n\t}\n\n\tss := tsrStatefulSet(tsr, r.tsNamespace, tsClient.LoginURL())\n\t_, err = createOrUpdate(ctx, r.Client, r.tsNamespace, ss, func(s *appsv1.StatefulSet) {\n\t\ts.ObjectMeta.Labels = ss.ObjectMeta.Labels\n\t\ts.ObjectMeta.Annotations = ss.ObjectMeta.Annotations\n\t\ts.Spec = ss.Spec\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating StatefulSet: %w\", err)\n\t}\n\n\t// ServiceAccount name may have changed, in which case we need to clean up\n\t// the previous ServiceAccount. RoleBinding will already be updated to point\n\t// to the new ServiceAccount.\n\tif err = r.maybeCleanupServiceAccounts(ctx, tsr, sa.Name); err != nil {\n\t\treturn fmt.Errorf(\"error cleaning up ServiceAccounts: %w\", err)\n\t}","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/tailscale/tailscale/blob/cfe32b8be6a33f8e24fbc369cbfbf7c729d9e042/cmd/k8s-operator/tsrecorder.go#L215-L251","documentation":"Error \"error creating RoleBinding: %w\" thrown in tailscale/tailscale.","triggerScenarios":"Thrown at cmd/k8s-operator/tsrecorder.go:233 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"}