kubernetes/kops · error

error creating sftp client (at stdout pipe): %w

Error message

error creating sftp client (at stdout pipe): %w

What it means

Returned by SSHPath.newClient while building an SFTP-over-SSH session: the SSH session was created and stdin piped, but obtaining the session's stdout pipe failed. This is a local ssh.Session plumbing failure (session already started or closed) before the sftp-server process is launched, not a remote error.

Source

Thrown at util/pkg/vfs/sshfs.go:76

		sftpClient, err := sftp.NewClient(p.client)
		if err != nil {
			return nil, fmt.Errorf("error creating sftp client: %w", err)
		}

		return sftpClient, nil
	}
	s, err := p.client.NewSession()
	if err != nil {
		return nil, fmt.Errorf("error creating sftp client (in new-session): %w", err)
	}

	stdin, err := s.StdinPipe()
	if err != nil {
		return nil, fmt.Errorf("error creating sftp client (at stdin pipe): %w", err)
	}
	stdout, err := s.StdoutPipe()
	if err != nil {
		return nil, fmt.Errorf("error creating sftp client (at stdout pipe): %w", err)
	}

	err = s.Start("sudo /usr/lib/openssh/sftp-server")
	if err != nil {
		return nil, fmt.Errorf("error creating sftp client (executing 'sudo /usr/lib/openssh/sftp-server'): %w", err)
	}

	c, err := sftp.NewClientPipe(stdout, stdin)
	if err != nil {
		return nil, fmt.Errorf("error starting sftp (executing 'sudo /usr/lib/openssh/sftp-server'): %w", err)
	}
	return c, nil
}

func (p *SSHPath) Path() string {
	return "ssh://" + p.server + p.path
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Check the underlying error; usually the SSH connection or session was closed concurrently — re-establish the connection and retry
  2. Avoid sharing one ssh.Client across concurrent sessions if the connection is flaky
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at util/pkg/vfs/sshfs.go:76 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/4c75def8a8ebe688. Report an issue: GitHub.