docker/cli ยท error

invalid argument: %w

Error message

invalid argument: %w

What it means

Error "invalid argument: %w" thrown in docker/cli.

Source

Thrown at cli/connhelper/ssh/ssh.go:172

	remoteCommand, err := quoteCommand(remoteCommandAndArgs...)
	if err != nil {
		return nil, err
	}
	if remoteCommand != "" {
		sshArgs = append(sshArgs, remoteCommand)
	}
	return sshArgs, nil
}

// quoteCommand returns the remote command to run using the ssh connection
// as a single string, quoting values where needed because ssh executes
// these in a POSIX shell.
func quoteCommand(commandAndArgs ...string) (string, error) {
	var quotedCmd string
	for i, arg := range commandAndArgs {
		a, err := syntax.Quote(arg, syntax.LangPOSIX)
		if err != nil {
			return "", fmt.Errorf("invalid argument: %w", err)
		}
		if i == 0 {
			quotedCmd = a
			continue
		}
		quotedCmd += " " + a
	}
	// each part is quoted appropriately, so now we'll have a full
	// shell command to pass off to "ssh"
	return quotedCmd, nil
}

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at cli/connhelper/ssh/ssh.go:172 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01). Data as JSON: /data/errors/4fcce9a08ab4cb83.json. Report an issue: GitHub.