wezterm/wezterm · error

Error: {}

Error message

Error: {}

What it means

Returned by ssh_connect_with_ui (mux/src/ssh.rs:124) when the SSH session emits SessionEvent::Error(err) during connection/authentication; the payload string is the underlying russh/transport error text. This is the generic failure channel of the wezterm-ssh event loop and covers protocol errors, IO failures, negotiation mismatches, and authentication rejections reported as errors.

Source

Thrown at mux/src/ssh.rs:124

                            ui.input(editor_prompt)
                        } else {
                            ui.password(editor_prompt)
                        };
                        if let Ok(line) = res {
                            answers.push(line);
                        } else {
                            anyhow::bail!("Authentication was cancelled");
                        }
                    }
                    smol::block_on(auth.answer(answers))?;
                }
                SessionEvent::HostVerificationFailed(failed) => {
                    let message = format_host_verification_for_terminal(failed);
                    ui.output(message);
                    anyhow::bail!("Host key verification failed");
                }
                SessionEvent::Error(err) => {
                    anyhow::bail!("Error: {}", err);
                }
                SessionEvent::Authenticated => return Ok(session),
            }
        }
        bail!("unable to authenticate session");
    })
}

fn format_host_verification_for_terminal(failed: HostVerificationFailed) -> Vec<Change> {
    vec![
        AttributeChange::Intensity(Intensity::Bold).into(),
        LineAttribute::DoubleHeightTopHalfLine.into(),
        Change::Text("REMOTE HOST IDENTIFICATION CHANGED\r\n".to_string()),
        LineAttribute::DoubleHeightBottomHalfLine.into(),
        Change::Text("REMOTE HOST IDENTIFICATION CHANGED\r\n".to_string()),
        Change::Text("SOMEONE MAY BE DOING SOMETHING NASTY!\r\n".to_string()),
        AttributeChange::Intensity(Intensity::Normal).into(),
        Change::Text("\r\nThere are two likely causes for this:\r\n".to_string()),

View on GitHub (pinned to 9c04f79f86)

Solutions

  1. Read the embedded error text first; it names the actual transport/protocol cause
  2. Test the same host with the OpenSSH cli (`ssh -v host`) to see whether it is server-side or wezterm-specific
  3. For algorithm negotiation issues, pin compatible algorithms in your ssh config (e.g. Ciphers/KexAlgorithms entries the server supports)
  4. For network flakiness, retry the connection; for firewalls/fail2ban, fix the blocking side
Defensive patterns

Strategy: retry

Try / catch

let mut attempt = 0;
loop {
    match ssh_connect_with_ui(config.clone(), &mut ui) {
        Ok(session) => break Ok(session),
        Err(err) if err.to_string().starts_with("Error: ") && attempt < 3 => {
            attempt += 1; // transport/protocol error: brief backoff, then retry
            std::thread::sleep(std::time::Duration::from_millis(500 * attempt as u64));
        }
        Err(err) => break Err(err),
    }
}

Prevention

When it happens

Trigger: TCP connection reset mid-handshake; unsupported algorithm negotiation (old server vs modern client defaults); key exchange failures; server-side auth error events; unreachable networks surfacing as transport errors.

Common situations: Flaky networks/VPNs dropping during handshake; connecting to very old or embedded SSH servers that lack modern kex/ciphers; server misconfiguration or fail2ban cutting the connection; firewall RSTs.

Related errors


AI-assisted analysis of wezterm/wezterm@9c04f79f86 (2026-08-16). Data as JSON: /api/errors/3a218d5f4baaf742. Report an issue: GitHub.