{"record":{"id":"fb7f1bee9ce8b24e","repo":"kubernetes/kops","slug":"error-deleting-s-w-fb7f1b","errorCode":null,"errorMessage":"error deleting %s: %w","messagePattern":"error deleting (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/pkg/vfs/sshfs.go","lineNumber":111,"sourceCode":"}\n\nfunc (p *SSHPath) String() string {\n\treturn p.Path()\n}\n\nfunc (p *SSHPath) Remove(ctx context.Context) error {\n\tsftpClient, err := p.newClient(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer sftpClient.Close()\n\n\terr = sftpClient.Remove(p.path)\n\tif err != nil {\n\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","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/util/pkg/vfs/sshfs.go#L93-L129","documentation":"Returned by SSHPath.Remove when the SFTP client's Remove call fails for a reason other than not-exist (which is passed through). The remote filesystem rejected the unlink — permission denied on the parent directory, the path is a non-empty directory, or the connection dropped — while deleting a single file over SFTP.","triggerScenarios":"Thrown at util/pkg/vfs/sshfs.go:111 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check permissions on the remote parent directory and use an appropriately privileged user","Use RemoveAll for directory trees instead of Remove on directories","Retry on transient connection drops after re-establishing the SFTP session"],"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"}