{"record":{"id":"88e208a70311afbb","repo":"apache/seatunnel","slug":"failed-to-get-home-directory","errorCode":null,"errorMessage":"Failed to get home directory","messagePattern":"Failed to get home directory","errorType":"exception","errorClass":"FTPException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-file/connector-file-ftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/ftp/system/SeaTunnelFTPFileSystem.java","lineNumber":867,"sourceCode":"        String to = absoluteDst.toUri().getPath();\n        return client.rename(from, to);\n    }\n\n    @Override\n    public Path getWorkingDirectory() {\n        // Return home directory always since we do not maintain state.\n        return getHomeDirectory();\n    }\n\n    @Override\n    public Path getHomeDirectory() {\n        FTPClient client = null;\n        try {\n            client = connect();\n            Path homeDir = new Path(client.printWorkingDirectory());\n            return homeDir;\n        } catch (IOException ioe) {\n            throw new FTPException(\"Failed to get home directory\", ioe);\n        } finally {\n            disconnect(client);\n        }\n    }\n\n    @Override\n    public void setWorkingDirectory(Path newDir) {\n        // we do not maintain the working directory state\n    }\n}\n","sourceCodeStart":849,"sourceCodeEnd":878,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-file/connector-file-ftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/ftp/system/SeaTunnelFTPFileSystem.java#L849-L878","documentation":"getHomeDirectory() connects to the FTP server and builds a Path from client.printWorkingDirectory(). Any IOException during connect() or printWorkingDirectory() is wrapped as FTPException 'Failed to get home directory'; the client is disconnected in finally.","triggerScenarios":"getHomeDirectory() invoked and connect() fails (bad host/port, auth rejected, network unreachable) or printWorkingDirectory() throws while negotiating with the FTP server.","commonSituations":"FTP host/port/credentials wrong in config; FTP server down or unreachable (firewall, DNS); passive-mode port blocked so the control connection opens but data-related commands fail; server rejects the user at login.","solutions":["Check the wrapped cause (getCause()) for the underlying connect/login failure","Validate ftp host, port, user, password in the connector config; test with ftp/lftp manually","Verify network reachability: telnet/nc to the FTP port; check firewall/NAT and enable passive mode if needed","Confirm the FTP service is running and accepting connections (server logs)"],"exampleFix":"// before\nPath home = ftpFileSystem.getHomeDirectory(); // throws FTPException on bad config\n// after\ntry {\n    Path home = ftpFileSystem.getHomeDirectory();\n} catch (FTPException e) {\n    log.error(\"FTP home lookup failed; check host/port/credentials. Cause: {}\", e.getCause());\n    throw e;\n}","handlingStrategy":"try-catch","validationCode":"// shell: verify FTP reachability before job\nnc -zv $FTP_HOST $FTP_PORT || echo \"FTP unreachable\"","typeGuard":null,"tryCatchPattern":"try {\n    Path home = ftpFileSystem.getHomeDirectory();\n} catch (FTPException e) {\n    logger.error(\"FTP home lookup failed; check host/port/credentials. Cause: {}\", e.getCause());\n    throw e;\n}","preventionTips":["Validate FTP host/port/user/password in config before deployment","Test the connection manually with ftp/lftp","Check firewall/NAT and enable passive mode","Ensure the FTP service is up (monitoring)"],"tags":["ftp","connection","auth"],"backgroundTag":"connection-refused","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}