{"record":{"id":"1737a1defe096f54","repo":"apache/seatunnel","slug":"file-file-does-not-exist","errorCode":null,"errorMessage":"File ${file} does not exist.","messagePattern":"File (.+?) does not exist\\.","errorType":"exception","errorClass":"FileNotFoundException","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":665,"sourceCode":"            boolean isDir = true;\n            int blockReplication = 1;\n            long blockSize = DEFAULT_BLOCK_SIZE; // Block Size not known.\n            long modTime = -1; // Modification time of root dir not known.\n            Path root = new Path(\"/\");\n            return new FileStatus(\n                    length, isDir, blockReplication, blockSize, modTime, root.makeQualified(this));\n        }\n        String pathName = parentPath.toUri().getPath();\n        FTPFile[] ftpFiles = client.listFiles(pathName);\n        if (ftpFiles != null) {\n            for (FTPFile ftpFile : ftpFiles) {\n                if (ftpFile.getName().equals(file.getName())) { // file found in dir\n                    fileStat = getFileStatus(ftpFile, parentPath);\n                    break;\n                }\n            }\n            if (fileStat == null) {\n                throw new FileNotFoundException(\"File \" + file + \" does not exist.\");\n            }\n        } else {\n            throw new FileNotFoundException(\"File \" + file + \" does not exist.\");\n        }\n        return fileStat;\n    }\n\n    /**\n     * Convert the file information in FTPFile to a {@link FileStatus} object. *\n     *\n     * @param ftpFile ftpFile\n     * @param parentPath parent path\n     * @return FileStatus\n     */\n    private FileStatus getFileStatus(FTPFile ftpFile, Path parentPath) {\n        long length = ftpFile.getSize();\n        boolean isDir = ftpFile.isDirectory();\n        int blockReplication = 1;","sourceCodeStart":647,"sourceCodeEnd":683,"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#L647-L683","documentation":"Thrown by SeaTunnelFTPFileSystem.getFileStatus() as a FileNotFoundException: the parent directory listing succeeded, but no entry in it matched the requested file name, so the file is confirmed absent on the FTP server.","triggerScenarios":"Calling getFileStatus()/exists-resolution paths with a file name that does not appear in the parent directory listing — file deleted before the call, wrong file name/case, or stale name generated by upstream logic.","commonSituations":"SeaTunnel job expecting an input file produced by a previous step that failed or wrote a different name; case mismatch (data.CSV vs data.csv); race with another job deleting the file; templated filenames with wrong date/time placeholders.","solutions":["List the parent directory and compare actual file names with the requested path","Check file name case matches the server exactly","Fix the upstream step or file-naming pattern that produces the file","Add an exists() guard or catch FileNotFoundException to handle absence gracefully"],"exampleFix":"// before\nFileStatus st = fs.getFileStatus(new Path(\"/data/report_2026-13-01.csv\"));\n// after\nPath p = new Path(\"/data/report_2026-09-01.csv\"); // corrected pattern\nif (fs.exists(p)) {\n    FileStatus st = fs.getFileStatus(p);\n}","handlingStrategy":"try-catch","validationCode":"Path p = new Path(\"/data/report.csv\");\nif (!fs.exists(p)) {\n    throw new IllegalStateException(\"Expected input file missing: \" + p);\n}","typeGuard":null,"tryCatchPattern":"try {\n    FileStatus st = fs.getFileStatus(p);\n} catch (FileNotFoundException e) {\n    // file genuinely absent: handle as missing input / trigger upstream job\n}","preventionTips":["Confirm upstream steps completed and wrote the expected file names","Match file name case exactly against server listings","Avoid fragile date/time templated names without validating the rendered value","Treat file absence as a first-class state (exists() checks, not exceptions)"],"tags":["ftp","file-not-found","getfilestatus","path"],"backgroundTag":"file-not-found","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"}