{"record":{"id":"d0fad4aa625513d7","repo":"kovidgoyal/kitty","slug":"failed-to-upload-s-ssh-master-process-died","errorCode":null,"errorMessage":"failed to upload %s, SSH master process died","messagePattern":"failed to upload (.+?), SSH master process died","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/remote_file/actions.go","lineNumber":192,"sourceCode":"\targv := append(append([]string{}, editor...), master.Dest)\n\tcmd := exec.Command(argv[0], argv[1:]...)\n\tcmd.Stdin, cmd.Stdout, cmd.Stderr = os.Stdin, os.Stdout, os.Stderr\n\tif err := cmd.Start(); err != nil {\n\t\treturn err\n\t}\n\tdone := make(chan error, 1)\n\tgo func() { done <- cmd.Wait() }()\n\tfor {\n\t\tselect {\n\t\tcase <-done:\n\t\t\treset_terminal()\n\t\t\tif master.IsAlive() {\n\t\t\t\tif err := master.Upload(false); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to upload %s: %w\", master.remote_path, err)\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"failed to upload %s, SSH master process died\", master.remote_path)\n\t\tcase <-time.After(100 * time.Millisecond):\n\t\t\tif st, err := os.Stat(master.Dest); err == nil && st.ModTime().After(mtime) {\n\t\t\t\tmtime = st.ModTime()\n\t\t\t\tif master.IsAlive() {\n\t\t\t\t\t_ = master.Upload(true)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","sourceCodeStart":174,"sourceCodeEnd":203,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/remote_file/actions.go#L174-L203","documentation":"After the local editor exits, edit_loop checks that the SSH ControlMaster process is still running via IsAlive(); if it died (crashed or exited), the edited file cannot be uploaded and this error is returned with the remote path. No upload is attempted.","triggerScenarios":"handle_action edit flow where the ssh master process exits during the editing session (network drop, ssh crash, server-side disconnect).","commonSituations":"Long editing sessions that outlive an idle/disconnected ssh multiplex master, network changes (WiFi switch, VPN drop), or ssh server killing idle connections.","solutions":["Reconnect ssh and rerun the remote file edit; local changes are safe","Configure ssh ClientAliveInterval / ServerAliveInterval to keep the master alive","Check whether the master exited due to network failure or an ssh error (master's log)","Consider shorter edit sessions or re-upload manually via scp"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"if !master.IsAlive() { /* re-establish master before upload */ }","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"master process died\") {\n    // reconnect ssh and re-upload local copy\n}","preventionTips":["Configure ServerAliveInterval to keep the master alive","Monitor master liveness during long edits","Save work locally so uploads can be retried"],"tags":["ssh","controlmaster","process-death","remote-file"],"backgroundTag":"ssh-connection-lost","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}