{"record":{"id":"b9da567208a3b37a","repo":"kubernetes/kops","slug":"expected-roleassignment-but-got-t","errorCode":null,"errorMessage":"expected RoleAssignment, but got %T","messagePattern":"expected RoleAssignment, but got %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resources/azure/azure.go","lineNumber":646,"sourceCode":"\treturn &resources.Resource{\n\t\tObj:     ra,\n\t\tType:    typeRoleAssignment,\n\t\tID:      *ra.ID,\n\t\tName:    *ra.Name,\n\t\tDeleter: g.deleteRoleAssignment,\n\t\tBlocks: []string{\n\t\t\ttoKey(typeResourceGroup, g.resourceGroupID()),\n\t\t},\n\t\t// Wait for the VMSS to be deleted before removing role assignments,\n\t\t// to avoid permission issues during VMSS teardown.\n\t\tBlocked: []string{toKey(typeVMScaleSet, *vmss.ID)},\n\t}\n}\n\nfunc (g *resourceGetter) deleteRoleAssignment(_ fi.Cloud, r *resources.Resource) error {\n\tra, ok := r.Obj.(*authz.RoleAssignment)\n\tif !ok {\n\t\treturn fmt.Errorf(\"expected RoleAssignment, but got %T\", r)\n\t}\n\treturn g.cloud.RoleAssignment().Delete(context.TODO(), *ra.Properties.Scope, *ra.Name)\n}\n\nfunc (g *resourceGetter) listLoadBalancers(ctx context.Context) ([]*resources.Resource, error) {\n\tloadBalancers, err := g.cloud.LoadBalancer().List(ctx, g.resourceGroupName())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar rs []*resources.Resource\n\tfor _, lb := range loadBalancers {\n\t\tif !g.isOwnedByCluster(lb.Tags) {\n\t\t\tcontinue\n\t\t}\n\t\tr, err := g.toLoadBalancerResource(lb)\n\t\tif err != nil {\n\t\t\treturn nil, err","sourceCodeStart":628,"sourceCodeEnd":664,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/resources/azure/azure.go#L628-L664","documentation":"A type assertion guard: deleteRoleAssignment finds the resource's Obj is not an *authz.RoleAssignment, meaning the resource tracker was built with the wrong object type — an internal invariant violation, not a user-input problem.","triggerScenarios":"Thrown at pkg/resources/azure/azure.go:646 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check how the resource tracker was created — Obj should be *authz.RoleAssignment","Report a kOps bug if this occurs with unmodified code","Re-run discovery so the resource tracker is rebuilt with the correct type"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}