kubernetes/kops · error
error removing file %s: %w
Error message
error removing file %s: %w
What it means
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.
Source
Thrown at util/pkg/vfs/sshfs.go:126
if os.IsNotExist(err) {
return err
}
return fmt.Errorf("error deleting %s: %w", p, err)
}
return nil
}
func (p *SSHPath) RemoveAll(ctx context.Context) error {
tree, err := p.ReadTree(ctx)
if err != nil {
return err
}
for _, filePath := range tree {
err := filePath.Remove(ctx)
if err != nil {
return fmt.Errorf("error removing file %s: %w", filePath, err)
}
}
return nil
}
func (p *SSHPath) RemoveAllVersions(ctx context.Context) error {
return p.Remove(ctx)
}
func (p *SSHPath) Join(relativePath ...string) Path {
args := []string{p.path}
args = append(args, relativePath...)
joined := path.Join(args...)
return NewSSHPath(p.client, p.server, joined, p.sudo)
}
func mkdirAll(sftpClient *sftp.Client, dir string) error {View on GitHub (pinned to 4c8573c808)
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
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at util/pkg/vfs/sshfs.go:126 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/2ba6c27e4cdfa236.
Report an issue: GitHub.