{"record":{"id":"bc650a1ce5dc3cf0","repo":"kovidgoyal/kitty","slug":"the-ssh-command-s-failed-w-with-output-s","errorCode":null,"errorMessage":"the ssh command: %s failed: %w with output: %s","messagePattern":"the ssh command: (.+?) failed: %w with output: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/remote_file/actions.go","lineNumber":33,"sourceCode":"\ntype ControlMaster struct {\n\tconn         *SSHConnectionData\n\tremote_path  string\n\ttdir         string\n\tDest         string\n\tLastErrorLog string\n}\n\nfunc new_control_master(conn *SSHConnectionData, remote_path, dest string) *ControlMaster {\n\treturn &ControlMaster{conn: conn, remote_path: remote_path, Dest: dest}\n}\n\nfunc (m *ControlMaster) check_call(argv []string) error {\n\tcmd := exec.Command(argv[0], argv[1:]...)\n\tcmd.Stdin = nil\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"the ssh command: %s failed: %w with output: %s\", strings.Join(argv, \" \"), err, string(out))\n\t}\n\treturn nil\n}\n\nfunc (m *ControlMaster) Start() (err error) {\n\tif !m.conn.IsSSHKitten {\n\t\tif err = m.check_call(append(m.conn.cmd_prefix(), \"-o\", \"ControlMaster=auto\", \"-fN\", m.conn.Hostname)); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err = m.check_call(append(m.conn.batch_cmd_prefix(), \"-O\", \"check\", m.conn.Hostname)); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif m.Dest == \"\" {\n\t\tif m.tdir, err = os.MkdirTemp(\"\", \"kitty-remote-file\"); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tm.Dest = filepath.Join(m.tdir, filepath.Base(m.remote_path))","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/remote_file/actions.go#L15-L51","documentation":"ControlMaster.check_call runs an ssh subcommand via CombinedOutput and wraps any non-zero exit or launch failure with the full argv and captured output. It indicates the multiplexed ssh control command itself failed (network, auth, or bad arguments). Start() calls it to establish the ControlMaster connection.","triggerScenarios":"Calling ControlMaster.Start() when ssh cannot reach the host, the control socket path is stale/broken, key authentication fails, or the ssh binary/args are malformed.","commonSituations":"SSH host key changed, agent not forwarded, ConnectionMultiplexing socket left over after reboot/network change, or a typo in hostname in --ssh-connection-data.","solutions":["Run the printed ssh command manually to see the real error","Remove stale control sockets (ControlPath, e.g. ssh -O exit host or delete socket files)","Verify network connectivity and key auth (ssh -v host)","Check that the hostname/binary passed in the ssh connection data is correct"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// pre-flight: socket check\nif _, err := os.Stat(master.SocketPath()); err == nil { /* stale socket? remove */ }","typeGuard":null,"tryCatchPattern":"if err := master.Start(); err != nil {\n    if strings.Contains(err.Error(), \"failed\") {\n        // inspect wrapped output, clean sockets, retry once\n    }\n}","preventionTips":["Clean stale ControlPath sockets before starting","Keep ssh agent loaded and reachable","Log the wrapped ssh output for diagnosis"],"tags":["ssh","controlmaster","network","process"],"backgroundTag":"ssh-command-failed","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}