zed-industries/zed · error

missing hostname

Error message

missing hostname

What it means

Thrown by the SSH URL/host-string parser after all token handling: neither a hostname nor an option-consumed value produced a host. The input contained options (like -l or -L) but no non-option token remained to use as the destination host, so there is nothing to connect to.

Source

Thrown at crates/remote/src/transport/ssh.rs:1751

                if let Some((rest, p)) = input.rsplit_once("]:") {
                    input = rest.strip_prefix('[').unwrap_or(rest);
                    port = p.parse().ok();
                } else if input.ends_with(']') {
                    input = input.strip_prefix('[').unwrap_or(input);
                    input = input.strip_suffix(']').unwrap_or(input);
                }
            } else if let Some((rest, p)) = input.rsplit_once(':')
                && !rest.contains(":")
            {
                input = rest;
                port = p.parse().ok();
            }

            hostname = Some(input.to_string())
        }

        let Some(hostname) = hostname else {
            anyhow::bail!("missing hostname");
        };

        let port_forwards = match port_forwards.len() {
            0 => None,
            _ => Some(port_forwards),
        };

        Ok(Self {
            host: hostname.into(),
            username,
            port,
            port_forwards,
            args: Some(args),
            password: None,
            nickname: None,
            upload_binary_over_ssh: false,
            connection_timeout: None,
        })

View on GitHub (pinned to f4178619ac)

Solutions

  1. Supply a hostname in the SSH string, e.g. user@host or host:port
  2. Check for typos like a leading '@' or missing host after the port
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/remote/src/transport/ssh.rs:1751 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/c45e15e1a425333f. Report an issue: GitHub.