{"record":{"id":"085c2bde5ff22172","repo":"apache/seatunnel","slug":"split-file-for-s-failed-cause-s-s","errorCode":null,"errorMessage":"Split file for [%s] failed, cause=%s: %s","messagePattern":"Split file for \\[(.+?)\\] failed, cause=(.+?): (.+?)","errorType":"error_code","errorClass":"SeaTunnelRuntimeException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/split/AccordingToSplitSizeSplitStrategy.java","lineNumber":122,"sourceCode":"                            new FileSourceSplit(\n                                    tableId,\n                                    normalizedPath,\n                                    currentStart,\n                                    fileSize - currentStart));\n                    break;\n                }\n                long actualEnd = findNextDelimiterWithSeek(input, tentativeEnd, fileSize);\n                if (actualEnd <= currentStart) {\n                    actualEnd = tentativeEnd;\n                }\n                splits.add(\n                        new FileSourceSplit(\n                                tableId, normalizedPath, currentStart, actualEnd - currentStart));\n                currentStart = actualEnd;\n            }\n            return splits;\n        } catch (IOException e) {\n            throw mapToRuntimeException(normalizedPath, \"Split file\", e);\n        }\n    }\n\n    private long safeGetFileSize(String filePath) {\n        try {\n            return hadoopFileSystemProxy.getFileStatus(filePath).getLen();\n        } catch (IOException e) {\n            throw mapToRuntimeException(filePath, \"Get file status\", e);\n        }\n    }\n\n    private static SeaTunnelRuntimeException mapToRuntimeException(\n            String filePath, String operation, IOException e) {\n        IOException unwrapped = unwrapRemoteException(e);\n        FileConnectorErrorCode errorCode = mapIOExceptionToErrorCode(unwrapped);\n        String message =\n                String.format(\n                        \"%s for [%s] failed, cause=%s: %s\",","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/split/AccordingToSplitSizeSplitStrategy.java#L104-L140","documentation":"AccordingToSplitSizeSplitStrategy.split divides a file into fixed-size splits using HDFS file status and positioned reads. Any IOException during splitting (file status, stream open/read) is mapped via mapToRuntimeException into a SeaTunnelRuntimeException: 'Split file for [path] failed, cause=...' so users get the offending path and cause instead of a raw Hadoop stack trace.","triggerScenarios":"An IOException thrown while computing splits — the underlying file disappearing between enumeration and split, permission errors reading the file, a namenode/storage outage, or network I/O failure while reading region boundaries.","commonSituations":"See trigger scenarios.","solutions":["Verify the file exists and is readable at the reported path (hdfs dfs -ls / gsutil ls, etc.)","Check Hadoop filesystem connectivity/credentials (Kerberos token, service account) at split time","Re-run the job; transient storage/network outages are a common cause","Check that the file was not truncated/deleted between listing and splitting (upstream writer still in progress)"],"exampleFix":"// before: file deleted mid-job\npath = gs://bucket/report.csv (removed by upstream job)\n// after: keep upstream writers from deleting; or point to a stable snapshot\npath = gs://bucket/snapshot=2026-09-10/report.csv","handlingStrategy":"try-catch","validationCode":"// verify readability before job submission\nFiles.exists(localPath) || hadoopFs.exists(new org.apache.hadoop.fs.Path(normalizedPath))","typeGuard":"static boolean fileExists(HadoopFileSystemProxy fs, String p) {\n    try { return fs.getFileStatus(p) != null; } catch (IOException e) { return false; }\n}","tryCatchPattern":"try {\n    List<FileSourceSplit> splits = strategy.split(context);\n} catch (SeaTunnelRuntimeException e) {\n    logger.error(\"splitting failed; check path/permissions/storage\", e);\n    throw e; // split failure is unrecoverable in-task\n}","preventionTips":["Ensure upstream writers finish (or use atomic rename) before SeaTunnel lists/splits files","Grant read permissions to the SeaTunnel process user on all source paths","Prefer stable snapshots/directories over files being actively rewritten"],"tags":["io","file-split","hadoop"],"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"}