{"record":{"id":"438aaced97a6087f","repo":"zed-industries/zed","slug":"ssh-tunnel-failed-to-establish-after-attempts","errorCode":null,"errorMessage":"SSH tunnel failed to establish after {} attempts","messagePattern":"SSH tunnel failed to establish after (.+?) attempts","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/repl/src/kernels/ssh_kernel.rs","lineNumber":187,"sourceCode":"                    Err(err) => {\n                        if attempt % 10 == 0 {\n                            log::debug!(\n                                \"Waiting for SSH tunnel (attempt {}/{}): {}\",\n                                attempt + 1,\n                                max_attempts,\n                                err\n                            );\n                        }\n                        if attempt < max_attempts - 1 {\n                            cx.background_executor()\n                                .timer(std::time::Duration::from_millis(100))\n                                .await;\n                        }\n                    }\n                }\n            }\n            if !connected {\n                anyhow::bail!(\n                    \"SSH tunnel failed to establish after {} attempts\",\n                    max_attempts\n                );\n            }\n\n            let mut local_connection_info = connection_info.clone();\n            local_connection_info[\"shell_port\"] = serde_json::json!(local_ports[0]);\n            local_connection_info[\"iopub_port\"] = serde_json::json!(local_ports[1]);\n            local_connection_info[\"stdin_port\"] = serde_json::json!(local_ports[2]);\n            local_connection_info[\"control_port\"] = serde_json::json!(local_ports[3]);\n            local_connection_info[\"hb_port\"] = serde_json::json!(local_ports[4]);\n            local_connection_info[\"ip\"] = serde_json::json!(\"127.0.0.1\");\n\n            let local_connection_file =\n                std::env::temp_dir().join(format!(\"zed_ssh_kernel_{}.json\", kernel_id));\n            std::fs::write(\n                &local_connection_file,\n                serde_json::to_string_pretty(&local_connection_info)?,","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/repl/src/kernels/ssh_kernel.rs#L169-L205","documentation":"Raised in the SSH kernel constructor after retrying the tunnel readiness check max_attempts times (100ms apart): each probe of the forwarded port failed, so the tunnel needed for the kernel's ZeroMQ connection never became available and the kernel cannot start.","triggerScenarios":"Thrown at crates/repl/src/kernels/ssh_kernel.rs:187 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify SSH connectivity to the remote host and that the remote kernel is running","Increase the attempt budget or check network latency/firewalls","Restart the remote kernel and retry the connection","Confirm the forwarded ports are not already in use"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}