kovidgoyal/kitty · error
failed to upload %s: %w
Error message
failed to upload %s: %w
What it means
In the remote_file edit loop, once the local editor signals done, the file is re-uploaded over the SSH ControlMaster. This error means Upload() returned an error (the underlying scp/ssh copy failed) while the master process was still alive; the remote path is included.
Source
Thrown at kittens/remote_file/actions.go:188
// Mirrors main.py handle_action's edit branch: reset the terminal (clear
// whatever the ask-menu/hostname-prompt phases drew) right before handing
// the screen to the user's $EDITOR, and again once it exits.
reset_terminal()
argv := append(append([]string{}, editor...), master.Dest)
cmd := exec.Command(argv[0], argv[1:]...)
cmd.Stdin, cmd.Stdout, cmd.Stderr = os.Stdin, os.Stdout, os.Stderr
if err := cmd.Start(); err != nil {
return err
}
done := make(chan error, 1)
go func() { done <- cmd.Wait() }()
for {
select {
case <-done:
reset_terminal()
if master.IsAlive() {
if err := master.Upload(false); err != nil {
return fmt.Errorf("failed to upload %s: %w", master.remote_path, err)
}
return nil
}
return fmt.Errorf("failed to upload %s, SSH master process died", master.remote_path)
case <-time.After(100 * time.Millisecond):
if st, err := os.Stat(master.Dest); err == nil && st.ModTime().After(mtime) {
mtime = st.ModTime()
if master.IsAlive() {
_ = master.Upload(true)
}
}
}
}
}
View on GitHub (pinned to 6d5d0c4406)
Solutions
- Check the wrapped error for the underlying scp/ssh failure reason
- Verify the remote path still exists and is writable
- Retry the edit/upload; if persistent, re-establish the ControlMaster
- Ensure remote disk space and permissions are adequate
Defensive patterns
Strategy: retry
Try / catch
if err := handle_action(...); err != nil && strings.Contains(err.Error(), "failed to upload") {
// re-check remote writability, re-establish master, retry upload
} Prevention
- Verify remote path writability before editing
- Keep the ControlMaster alive during sessions
- Retry uploads on transient network errors
When it happens
Trigger: Calling handle_action for an edit where the remote host rejects the copy (permissions changed, disk full, remote path removed) even though the ssh master is up.
Common situations: Remote file deleted or permissions changed while editing, remote filesystem full, or transient network degradation causing the multiplexed copy to fail.
Related errors
- failed to upload %s, SSH master process died
- This should be run as kitten ssh
- Incorrect owner on pwfile: uid={shm.stats.st_uid} gid={shm.s
- Incorrect permissions on pwfile: 0o{mode:03o}
- Incorrect password
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/ddded174a8ffedae.
Report an issue: GitHub.