{"record":{"id":"2a140579b02f503f","repo":"jdx/mise","slug":"remote-upload-to-failed-with-status","errorCode":null,"errorMessage":"remote upload to '{}' failed with {status}","messagePattern":"remote upload to '(.+?)' failed with (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/remote.rs","lineNumber":2074,"sourceCode":"        let output = tokio::process::Command::new(&self.ssh)\n            .args(args)\n            .kill_on_drop(true)\n            .output()\n            .await?;\n        checked_output(output, &self.host.name)\n    }\n\n    async fn status_with_stdin_async(&self, remote_argv: &[&str], input: File) -> Result<()> {\n        let args = self.args(false, remote_argv);\n        info!(\"$ {} {}\", self.ssh.display(), shell_words::join(&args));\n        let status = tokio::process::Command::new(&self.ssh)\n            .args(args)\n            .stdin(Stdio::from(input))\n            .kill_on_drop(true)\n            .status()\n            .await?;\n        if !status.success() {\n            bail!(\"remote upload to '{}' failed with {status}\", self.host.name);\n        }\n        Ok(())\n    }\n\n    async fn upload_executable(&self, local: &Path, remote: &str) -> Result<()> {\n        let file = File::open(local)\n            .wrap_err_with(|| format!(\"failed to open mise binary {}\", local.display()))?;\n        self.status_with_stdin_async(\n            &[\n                \"sh\",\n                \"-c\",\n                &format!(\n                    \"cat > {} && chmod 700 {}\",\n                    shell_quote(remote),\n                    shell_quote(remote)\n                ),\n            ],\n            file,","sourceCodeStart":2056,"sourceCodeEnd":2092,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/remote.rs#L2056-L2092","documentation":"`upload_file`/related upload path in src/system/remote.rs streams a local file to the remote host over SSH (e.g. `ssh host dd/cat`) and bails if the spawned process exits non-success, embedding the exit `status` in the message. The upload command itself ran but the remote side (or local ssh client) failed.","triggerScenarios":"`ssh`/`scp`-style upload invoked with a non-zero exit: ssh authentication failure, remote shell refusing the command, remote disk full, connection dropped mid-transfer, or the remote command not permitted.","commonSituations":"SSH key not loaded in the agent; remote ~/.ssh/authorized_keys misconfigured; read-only or full remote filesystem at the staging path; network interruption during a large binary upload.","solutions":["Verify SSH connectivity manually first: `ssh <host> true` — fix auth (ssh-agent, keys) if it fails","Check remote disk space and write permission for the staging path (`df -h`, `ls -ld /tmp` on the host)","Re-run the operation; for transient network drops, ensure ControlMaster/connection reuse or retry after restoring connectivity"],"exampleFix":"// before\n$ mise remote-upload ssh://deploy@host\nError: remote upload to 'deploy@host' failed with exit status: 255\n// after\n$ ssh-add ~/.ssh/deploy_key   # load missing key\n$ ssh deploy@host true        # verify auth works\n$ mise remote-upload ssh://deploy@host   # succeeds","handlingStrategy":"try-catch","validationCode":"# before uploading, verify ssh works\nssh -o BatchMode=yes -o ConnectTimeout=5 \"$host\" true \\\\\\n  || { echo \"ssh to $host unavailable\"; exit 1; }\n# and remote /tmp is writable\nssh \"$host\" 'test -w /tmp' || { echo \"remote /tmp not writable\"; exit 1; }","typeGuard":null,"tryCatchPattern":"match upload_result {\n    Err(e) if e.to_string().contains(\"remote upload\") => {\n        eprintln!(\"upload failed: {e}; check ssh auth and remote disk space\");\n        // optionally retry once after `ssh-add` / connectivity check\n    }\n    Err(e) => return Err(e),\n    Ok(()) => {}\n}","preventionTips":["Preload SSH keys into ssh-agent and test `ssh host true` first","Monitor remote disk space on staging hosts","Use SSH ControlMaster for connection reuse and resilience"],"tags":["remote","ssh","upload","process-exit"],"backgroundTag":"command-failed","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}