zed-industries/zed · error

cannot open both local and ssh paths

Error message

cannot open both local and ssh paths

What it means

Raised in parse_ssh_file_path when an SSH path is being opened while open_paths already contains local file paths. A single open request cannot mix local and SSH destinations, so the guard rejects the URL with this sentinel before adding it.

Solutions

  1. Open local and SSH paths in separate requests/windows
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/zed/src/zed/open_listener.rs:301 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/7757d81c6b34c8a0. Report an issue: GitHub.

Appendix: source

Thrown at crates/zed/src/zed/open_listener.rs:301

    }

    fn parse_ssh_file_path(&mut self, file: &str, cx: &App) -> Result<()> {
        let url = parse_ssh_url(file)?;
        let host = match url
            .host()
            .with_context(|| format!("missing host in ssh url: {url}"))?
        {
            url::Host::Domain(host) => host.to_string(),
            url::Host::Ipv4(host) => host.to_string(),
            url::Host::Ipv6(host) => host.to_string(),
        };
        let username = if url.username().is_empty() {
            None
        } else {
            Some(urlencoding::decode(url.username())?.into_owned())
        };
        let port = url.port();
        anyhow::ensure!(
            self.open_paths.is_empty(),
            "cannot open both local and ssh paths"
        );
        let mut connection_options =
            RemoteSettings::get_global(cx).connection_options_for(host, port, username);
        if let Some(password) = url.password() {
            connection_options.password = Some(urlencoding::decode(password)?.into_owned());
        }

        let connection_options = RemoteConnectionOptions::Ssh(connection_options);
        if let Some(ssh_connection) = &self.remote_connection {
            anyhow::ensure!(
                *ssh_connection == connection_options,
                "cannot open multiple different remote connections"
            );
        }
        self.remote_connection = Some(connection_options);
        self.parse_file_path(url.path());

View on GitHub (pinned to f4178619ac)