{"record":{"id":"c7f8f1434db9bfbb","repo":"arduino/Arduino","slug":"unable-to-find-a-way-to-connect","errorCode":null,"errorMessage":"Unable to find a way to connect","messagePattern":"Unable to find a way to connect","errorType":"exception","errorClass":"JSchException","httpStatus":null,"severity":"error","filePath":"arduino-core/src/cc/arduino/packages/ssh/SSHConfigFileSetup.java","lineNumber":57,"sourceCode":"\n  private final SSHClientSetupChainRing nextChainRing;\n\n  public SSHConfigFileSetup(SSHClientSetupChainRing nextChainRing) {\n    this.nextChainRing = nextChainRing;\n  }\n\n  @Override\n  public Session setup(BoardPort port, JSch jSch) throws JSchException, IOException {\n    String ipAddress = port.getAddress();\n\n    File sshFolder = new File(System.getProperty(\"user.home\"), \".ssh\");\n    File sshConfig = new File(sshFolder, \"config\");\n\n    if (!sshFolder.exists() || !sshConfig.exists()) {\n      if (nextChainRing != null) {\n        return nextChainRing.setup(port, jSch);\n      }\n      throw new JSchException(\"Unable to find a way to connect\");\n    }\n\n    OpenSSHConfig configRepository = OpenSSHConfig.parseFile(sshConfig.getAbsolutePath());\n\n    jSch.setConfigRepository(new OpenSSHConfigWrapper(configRepository, ipAddress));\n\n    return jSch.getSession(ipAddress);\n  }\n\n  public static class OpenSSHConfigWrapper implements ConfigRepository {\n\n    private final OpenSSHConfig config;\n    private final String ipAddress;\n\n    public OpenSSHConfigWrapper(OpenSSHConfig config, String ipAddress) {\n      this.config = config;\n      this.ipAddress = ipAddress;\n    }","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/arduino/Arduino/blob/a0df6e0e83b652c72bc78b0a1376c54d6ebc3bee/arduino-core/src/cc/arduino/packages/ssh/SSHConfigFileSetup.java#L39-L75","documentation":"SSHConfigFileSetup.setup is one link in a chain of SSH configuration strategies for connecting to a network board. If ~/.ssh/config does not exist and no next strategy in the chain can handle the connection, it throws this JSchException meaning no connection method succeeded.","triggerScenarios":"Connecting to a network (Yún-style) board when ~/.ssh directory or ~/.ssh/config file is missing AND all previous/next chain strategies (default password/identity based) failed or were absent.","commonSituations":"Fresh machines with no SSH setup trying to reach a network board; wrong IP address so authentication strategies never apply; permissions issues preventing reading ~/.ssh/config.","solutions":["Verify the board's IP address and that it is reachable (ping)","Create/populate ~/.ssh/config with a Host entry for the board, or let the IDE password prompt proceed","Check ~/.ssh directory permissions (700) and config permissions (600)","Reset the board and retry, since the board may have dropped off the network"],"exampleFix":"// before: no ~/.ssh/config\n// after\nHost myyun\n  HostName 192.168.240.1\n  User root","handlingStrategy":"validation","validationCode":"File cfg = new File(System.getProperty(\"user.home\"), \".ssh/config\");\nif (!cfg.exists()) {\n    // ensure an SSH config Host entry exists or expect password fallback prompt\n}\n","typeGuard":null,"tryCatchPattern":"try {\n    connect(port);\n} catch (JSchException e) {\n    if (e.getMessage().equals(\"Unable to find a way to connect\")) {\n        // create ~/.ssh/config or verify board address, then retry\n    }\n}","preventionTips":["Keep a valid ~/.ssh/config with a Host entry for network boards","Use 700/600 permissions on ~/.ssh and config","Confirm the board IP with a ping before uploading"],"tags":["ssh","network","configuration","jsch"],"backgroundTag":"config-file-not-found","analyzedSha":"a0df6e0e83b652c72bc78b0a1376c54d6ebc3bee","analyzedAt":"2026-09-06T10:13:38.901Z","contentChangedAt":"2026-09-06T10:13:38.901Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}