{"record":{"id":"9b263abeaf2ef3ef","repo":"kubernetes/kops","slug":"refusing-to-delete-unknown-file-found-s","errorCode":null,"errorMessage":"refusing to delete: unknown file found: %s","messagePattern":"refusing to delete: unknown file found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/client/simple/vfsclientset/clientset.go","lineNumber":186,"sourceCode":"\t\t}\n\t\tif strings.HasPrefix(relativePath, \"secrets/\") {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasPrefix(relativePath, \"instancegroup/\") {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasPrefix(relativePath, \"igconfig/\") {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasPrefix(relativePath, \"manifests/\") {\n\t\t\tcontinue\n\t\t}\n\t\t// TODO: offer an option _not_ to delete backups?\n\t\tif strings.HasPrefix(relativePath, \"backups/\") {\n\t\t\tcontinue\n\t\t}\n\n\t\treturn fmt.Errorf(\"refusing to delete: unknown file found: %s\", path)\n\t}\n\n\terr = basePath.RemoveAll(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error deleting cluster files in %s: %w\", basePath, err)\n\t}\n\n\treturn nil\n}\n\nfunc (c *VFSClientset) DeleteCluster(ctx context.Context, cluster *kops.Cluster) error {\n\tif cluster.Spec.ServiceAccountIssuerDiscovery != nil {\n\t\tdiscoveryStore := cluster.Spec.ServiceAccountIssuerDiscovery.DiscoveryStore\n\t\tif discoveryStore != \"\" {\n\t\t\tpath, err := c.VFSContext().BuildVfsPath(discoveryStore)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/client/simple/vfsclientset/clientset.go#L168-L204","documentation":"A deliberate safety guard in DeleteAllClusterState: the state store contains a file outside the kOps-managed prefixes (config, pki, secrets, instancegroup, igconfig, manifests, backups), so kOps refuses the recursive RemoveAll to avoid destroying unrecognized data.","triggerScenarios":"Thrown at pkg/client/simple/vfsclientset/clientset.go:186 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the listed file in the state store and move or delete it manually if unwanted","Confirm the state store is exclusively kOps-managed and not shared with other tools","Re-run the cluster deletion once the unknown file is resolved"],"exampleFix":null,"handlingStrategy":"validation","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"}