{"record":{"id":"fe3a989746a39552","repo":"apache/seatunnel","slug":"file-check-failed","errorCode":null,"errorMessage":"File check failed","messagePattern":"File check failed","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":781,"sourceCode":"                                client.getReplyCode(),\n                                client.getReplyString()));\n            }\n        }\n        return true;\n    }\n\n    /**\n     * Convenience method, so that we don't open a new connection when using this method from within\n     * another method. Otherwise every API invocation incurs the overhead of opening/closing a TCP\n     * connection.\n     */\n    private boolean isFile(FTPClient client, Path file) {\n        try {\n            return getFileStatus(client, file).isFile();\n        } catch (FileNotFoundException e) {\n            return false; // file does not exist\n        } catch (IOException ioe) {\n            throw new FTPException(\"File check failed\", ioe);\n        }\n    }\n\n    /*\n     * Assuming that parent of both source and destination is the same. Is the\n     * assumption correct or it is supposed to work like 'move' ?\n     */\n    @Override\n    public boolean rename(Path src, Path dst) throws IOException {\n        FTPClient client = connect();\n        try {\n            boolean success = rename(client, src, dst);\n            return success;\n        } finally {\n            disconnect(client);\n        }\n    }\n","sourceCodeStart":763,"sourceCodeEnd":799,"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#L763-L799","documentation":"isFile(FTPClient, Path) delegates to getFileStatus to determine if a path is a regular file. If getFileStatus fails with a generic IOException (not FileNotFoundException, which is treated as 'does not exist'), the method wraps it in an FTPException with the message 'File check failed' and the original cause attached.","triggerScenarios":"Any IOException other than FileNotFoundException thrown by getFileStatus(client, file) during isFile — e.g. FTP connection reset mid-operation, socket timeout, or unexpected server reply — while checking whether a path is a file.","commonSituations":"FTP connection dropped or timed out between operations; server returned an unexpected reply code; network interruption during long-running sink/source jobs; FTP control channel in a bad state after a failed transfer.","solutions":["Inspect the wrapped cause (ioe.getCause()) for the actual FTP/network failure","Verify FTP server availability and increase ftp connect/timeout settings in the connector config","Enable FTPClient passive mode if behind NAT/firewall","Retry the job — transient connection resets are common on unstable networks","Check server-side logs for session drops (idle timeout, max connections limit reached)"],"exampleFix":"// before\ntry {\n    boolean isFile = fs.isFile(path);\n} catch (FTPException e) { log.error(\"failed\", e); }\n// after\ntry {\n    boolean isFile = fs.isFile(path);\n} catch (FTPException e) {\n    log.error(\"File check failed, FTP cause: {}\", e.getCause(), e);\n    // reconnect and retry before failing the job\n}","handlingStrategy":"try-catch","validationCode":"// Java: check connectivity before file operations\nFTPClient c = connect();\nif (!FTPReply.isPositiveCompletion(c.getReplyCode())) {\n    throw new IllegalStateException(\"FTP not ready: \" + c.getReplyString());\n}","typeGuard":null,"tryCatchPattern":"try {\n    boolean isFile = fs.isFile(path);\n} catch (FTPException e) {\n    logger.error(\"FTP file check failed; root cause: {}\", e.getCause(), e);\n    // reconnect and retry once for transient IO errors\n}","preventionTips":["Set adequate FTP connect/socket timeouts in config","Use passive mode behind firewalls/NAT","Keep control connections alive (setControlKeepAliveTimeout) for long jobs","Monitor FTP server idle/session limits"],"tags":["ftp","io","connection"],"backgroundTag":"file-read-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}