{"record":{"id":"2ba6c27e4cdfa236","repo":"kubernetes/kops","slug":"error-removing-file-s-w-2ba6c2","errorCode":null,"errorMessage":"error removing file %s: %w","messagePattern":"error removing file (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/pkg/vfs/sshfs.go","lineNumber":126,"sourceCode":"\t\tif os.IsNotExist(err) {\n\t\t\treturn err\n\t\t}\n\t\treturn fmt.Errorf(\"error deleting %s: %w\", p, err)\n\t}\n\n\treturn nil\n}\n\nfunc (p *SSHPath) RemoveAll(ctx context.Context) error {\n\ttree, err := p.ReadTree(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, filePath := range tree {\n\t\terr := filePath.Remove(ctx)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error removing file %s: %w\", filePath, err)\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc (p *SSHPath) RemoveAllVersions(ctx context.Context) error {\n\treturn p.Remove(ctx)\n}\n\nfunc (p *SSHPath) Join(relativePath ...string) Path {\n\targs := []string{p.path}\n\targs = append(args, relativePath...)\n\tjoined := path.Join(args...)\n\treturn NewSSHPath(p.client, p.server, joined, p.sudo)\n}\n\nfunc mkdirAll(sftpClient *sftp.Client, dir string) error {","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/util/pkg/vfs/sshfs.go#L108-L144","documentation":"Returned by SSHPath.RemoveAll when deleting an individual file from the ReadTree listing fails during a recursive purge. The per-file Remove error (remote permissions, read-only filesystem, or connection loss) is wrapped with the failing path so the caller can see which tree entry aborted the cleanup.","triggerScenarios":"Thrown at util/pkg/vfs/sshfs.go:126 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix remote permissions on the reported path and re-run RemoveAll — already-deleted files return not-exist and are tolerated","Verify the filesystem isn't read-only or the disk isn't in an error state"],"exampleFix":null,"handlingStrategy":"retry","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"}