{"record":{"id":"07508ea461390790","repo":"apache/seatunnel","slug":"file-check-failed-07508e","errorCode":null,"errorMessage":"File check failed","messagePattern":"File check failed","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-file/connector-file-sftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sftp/system/SFTPFileSystem.java","lineNumber":345,"sourceCode":"            }\n        } else if (isFile(client, absolute)) {\n            throw new IOException(String.format(E_DIR_CREATE_FROMFILE, absolute));\n        } else {\n            LOG.debug(\"Skipping creation of existing directory \" + file);\n        }\n        if (!created) {\n            LOG.debug(\"Failed to create \" + file);\n        }\n        return created;\n    }\n\n    private boolean isFile(ChannelSftp channel, Path file) throws IOException {\n        try {\n            return !getFileStatus(channel, file).isDirectory();\n        } catch (FileNotFoundException e) {\n            return false; // file does not exist\n        } catch (IOException ioe) {\n            throw new IOException(E_FILE_CHECK_FAILED, ioe);\n        }\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 delete(ChannelSftp channel, Path file, boolean recursive) throws IOException {\n        Path workDir;\n        try {\n            workDir = new Path(channel.pwd());\n        } catch (SftpException e) {\n            throw new IOException(e);\n        }\n        Path absolute = makeAbsolute(workDir, file);\n        String pathName = absolute.toUri().getPath();\n        FileStatus fileStat = null;","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-file/connector-file-sftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sftp/system/SFTPFileSystem.java#L327-L363","documentation":"isFile() returns true only if the path exists and is not a directory; a FileNotFoundException yields false (treated as 'not a file'). Any other IOException from the underlying getFileStatus (broken channel, pwd/ls failures) is rethrown wrapped as 'File check failed'. It means the file-type check itself could not be completed due to an SFTP communication error.","triggerScenarios":"isFile() (called from mkdirs to detect path-type conflicts) hits a non-FNFE IOException from getFileStatus — e.g. dead channel, pwd rejected, symlink resolution failure.","commonSituations":"SFTP session dropped during a directory-creation sequence; symlinked output paths failing to resolve; permission problems on ancestor directories surfacing as IO (not FNFE) errors.","solutions":["Reconnect the SFTP channel before retrying mkdirs/isFile","Check permissions on all ancestor directories of the path","Resolve or remove broken symlinks on the path","Inspect ioe.getCause() for the underlying SftpException id","Add SSH keepalive to prevent idle session drops during long jobs"],"exampleFix":"// before\nfs.mkdirs(new Path(\"/data/out\")); // isFile check throws 'File check failed'\n// after\ntry {\n    fs.mkdirs(new Path(\"/data/out\"));\n} catch (IOException e) {\n    LOG.warn(\"mkdirs failed\", e);\n    reconnect(); // refresh SFTP channel\n    fs.mkdirs(new Path(\"/data/out\"));\n}","handlingStrategy":"try-catch","validationCode":"if (channel == null || !channel.isConnected()) { channel = openConnectedChannel(conf); } // plus server-side: find /data -type l (audit symlinks)","typeGuard":null,"tryCatchPattern":"try { fs.mkdirs(p); } catch (IOException e) { if (e.getMessage() != null && e.getMessage().contains(\"File check failed\")) { reconnect(); fs.mkdirs(p); } else { throw e; } }","preventionTips":["Keep the channel alive (SSH keepalive) through long mkdirs recursion","Fix permissions on ancestors so checks return FNFE not IO errors","Remove broken symlinks from job paths","Inspect getCause() for the real SftpException","Reconnect and retry once on communication errors"],"tags":["sftp","ioexception","file-check"],"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-23T08:17:48.524Z"}