{"record":{"id":"689e2761a637d69d","repo":"apache/seatunnel","slug":"failed-to-parse-job-config-file-path","errorCode":null,"errorMessage":"Failed to parse job config file: <path>","messagePattern":"Failed to parse job config file: <path>","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"seatunnel-config/seatunnel-config-sql/src/main/java/org/apache/seatunnel/config/sql/SqlConfigBuilder.java","lineNumber":86,"sourceCode":"import static org.apache.seatunnel.config.sql.utils.Constant.OPTION_TABLE_TYPE_SINK;\nimport static org.apache.seatunnel.config.sql.utils.Constant.OPTION_TABLE_TYPE_SOURCE;\nimport static org.apache.seatunnel.config.sql.utils.Constant.OPTION_TABLE_TYPE_TRANSFORM;\nimport static org.apache.seatunnel.config.sql.utils.Constant.SQL_ANNOTATION_PREFIX;\nimport static org.apache.seatunnel.config.sql.utils.Constant.SQL_ANNOTATION_PREFIX2;\nimport static org.apache.seatunnel.config.sql.utils.Constant.SQL_ANNOTATION_SUFFIX;\nimport static org.apache.seatunnel.config.sql.utils.Constant.SQL_CONFIG_ANNOTATION_PREFIX;\nimport static org.apache.seatunnel.config.sql.utils.Constant.SQL_DELIMITER;\nimport static org.apache.seatunnel.config.sql.utils.Constant.TEMP_TABLE_SUFFIX;\n\n@Slf4j\npublic class SqlConfigBuilder {\n\n    public static Config of(@NonNull Path sqlFilePath) {\n        try {\n            List<String> lines = Files.readAllLines(sqlFilePath);\n            return of(lines);\n        } catch (Exception e) {\n            throw new RuntimeException(\"Failed to parse job config file: \" + sqlFilePath, e);\n        }\n    }\n\n    public static Config of(@NonNull String sqlContent) {\n        try {\n            List<String> lines = new ArrayList<>();\n            String[] lineArray = sqlContent.split(\"\\\\r?\\\\n\");\n            Collections.addAll(lines, lineArray);\n            return of(lines);\n        } catch (Exception e) {\n            throw new RuntimeException(\"Failed to parse job config: \", e);\n        }\n    }\n\n    private static Config of(@NonNull List<String> lines) {\n        try {\n            Map<String, BaseConfig> sqlTables = new LinkedHashMap<>();\n            SeaTunnelConfig seaTunnelConfig = new SeaTunnelConfig();","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-config/seatunnel-config-sql/src/main/java/org/apache/seatunnel/config/sql/SqlConfigBuilder.java#L68-L104","documentation":"SqlConfigBuilder.of(Path) reads the SQL job config file and wraps any failure (unreadable file, JSqlParser syntax error, etc.) in a RuntimeException with this message, chaining the original exception as the cause. It is a coarse wrapper: the root cause in the stack trace is what actually matters.","triggerScenarios":"Calling SqlConfigBuilder.of(Path) with a path that doesn't exist, is a directory, lacks read permission, or where the file content fails to parse as a valid seatunnel SQL config.","commonSituations":"Typo in the --config path, running the job from a different working directory than assumed, SQL syntax errors in the .sql file surfaced as 'parse failed' rather than a parser message.","solutions":["Read the 'Caused by' of the stack trace to find the real error (NoSuchFileException vs SQL parse error).","Verify the file path exists and is readable: ls -l <path> and use an absolute path.","Validate the SQL content with the string-based of(String) to isolate file I/O from parsing.","Fix SQL syntax errors reported in the cause before re-running."],"exampleFix":"// before\nConfig c = SqlConfigBuilder.of(Paths.get(\"job.sql\")); // file missing -> RuntimeException\n// after\nPath p = Paths.get(\"/abs/path/job.sql\");\nif (!Files.isRegularFile(p)) {\n    throw new IllegalArgumentException(\"Config file not found: \" + p);\n}\nConfig c2 = SqlConfigBuilder.of(p);","handlingStrategy":"try-catch","validationCode":"if (!java.nio.file.Files.isRegularFile(path) || !java.nio.file.Files.isReadable(path)) throw new IllegalArgumentException(\"Bad config path: \" + path);","typeGuard":null,"tryCatchPattern":"try { Config c = SqlConfigBuilder.of(path); } catch (RuntimeException e) { Throwable root = e; while (root.getCause() != null) root = root.getCause(); log.error(\"Config load failed: {}\", root.getMessage(), root); }","preventionTips":["Use absolute paths for config files","Check file existence/readability before submission","Always inspect the 'Caused by' chain","Lint SQL files before submitting jobs"],"tags":["sql-config","file-io","config-parsing","java"],"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-14T05:17:10.506Z"}