{"record":{"id":"f0d957559cf3cf9b","repo":"apache/seatunnel","slug":"failed-to-parse-job-config","errorCode":null,"errorMessage":"Failed to parse job config: ","messagePattern":"Failed to parse job config: ","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":97,"sourceCode":"public 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();\n\n            List<String> sqlLines = parseAnnoConfigAndSqlLine(lines, seaTunnelConfig);\n\n            // Split SQL\n            List<String> sqlList = split4SqlList(sqlLines);\n\n            for (Iterator<String> it = sqlList.iterator(); it.hasNext(); ) {\n                String sql = it.next();\n                Statement statement = CCJSqlParserUtil.parse(sql);\n                if (statement instanceof CreateTable) {\n                    CreateTable createTable = (CreateTable) statement;","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-config/seatunnel-config-sql/src/main/java/org/apache/seatunnel/config/sql/SqlConfigBuilder.java#L79-L115","documentation":"SqlConfigBuilder.of(String) splits the SQL content into lines and parses it; any exception (JSqlParser errors, missing source/sink, template rendering) is wrapped in a RuntimeException with this message. Note the message has no path suffix, so the cause holds the real details. The original exception is chained as the cause.","triggerScenarios":"Calling SqlConfigBuilder.of(String sqlContent) with invalid SQL statements, content that is not CREATE TABLE/INSERT syntax, or content violating seatunnel SQL config requirements (e.g. missing WITH options).","commonSituations":"Reading the .sql file with wrong encoding or CRLF issues, embedding SQL with comments or syntax JSqlParser can't handle, programmatic submission where the SQL string was truncated.","solutions":["Inspect the 'Caused by' chain for the true parser error and its line number.","Test the same SQL via SqlConfigBuilder.of(Path) to reproduce in isolation.","Fix the SQL syntax or add missing WITH ('connector'='...') options.","Ensure the string contains proper newline-separated statements (split on \\r?\\n is applied internally)."],"exampleFix":"// before\nConfig c = SqlConfigBuilder.of(\"CREATE TABLE t (id INT)\"); // no source connector -> wrapped error\n// after\nConfig c2 = SqlConfigBuilder.of(\n  \"CREATE TABLE t WITH ('connector'='fake', 'type'='source') (id INT);\\n\" +\n  \"INSERT INTO s SELECT * FROM t;\");","handlingStrategy":"try-catch","validationCode":"// dry-run the same SQL through the file-based API\nConfig c = SqlConfigBuilder.of(java.nio.file.Path.of(\"/tmp/check.sql\"));","typeGuard":null,"tryCatchPattern":"try { Config c = SqlConfigBuilder.of(sql); } catch (RuntimeException e) { log.error(\"SQL config invalid\", e.getCause()); }","preventionTips":["Keep one statement per line, newline-separated","Avoid SQL syntax unsupported by JSqlParser","Always include source + INSERT statements","Test SQL with a lint/parser before submission"],"tags":["sql-config","config-parsing","java"],"backgroundTag":"sql-query-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"}