apache/seatunnel · error · RuntimeException

Failed to parse job config:

Error message

Failed to parse job config: 

What it means

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.

Source

Thrown at seatunnel-config/seatunnel-config-sql/src/main/java/org/apache/seatunnel/config/sql/SqlConfigBuilder.java:97

public class SqlConfigBuilder {

    public static Config of(@NonNull Path sqlFilePath) {
        try {
            List<String> lines = Files.readAllLines(sqlFilePath);
            return of(lines);
        } catch (Exception e) {
            throw new RuntimeException("Failed to parse job config file: " + sqlFilePath, e);
        }
    }

    public static Config of(@NonNull String sqlContent) {
        try {
            List<String> lines = new ArrayList<>();
            String[] lineArray = sqlContent.split("\\r?\\n");
            Collections.addAll(lines, lineArray);
            return of(lines);
        } catch (Exception e) {
            throw new RuntimeException("Failed to parse job config: ", e);
        }
    }

    private static Config of(@NonNull List<String> lines) {
        try {
            Map<String, BaseConfig> sqlTables = new LinkedHashMap<>();
            SeaTunnelConfig seaTunnelConfig = new SeaTunnelConfig();

            List<String> sqlLines = parseAnnoConfigAndSqlLine(lines, seaTunnelConfig);

            // Split SQL
            List<String> sqlList = split4SqlList(sqlLines);

            for (Iterator<String> it = sqlList.iterator(); it.hasNext(); ) {
                String sql = it.next();
                Statement statement = CCJSqlParserUtil.parse(sql);
                if (statement instanceof CreateTable) {
                    CreateTable createTable = (CreateTable) statement;

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Inspect the 'Caused by' chain for the true parser error and its line number.
  2. Test the same SQL via SqlConfigBuilder.of(Path) to reproduce in isolation.
  3. Fix the SQL syntax or add missing WITH ('connector'='...') options.
  4. Ensure the string contains proper newline-separated statements (split on \r?\n is applied internally).

Example fix

// before
Config c = SqlConfigBuilder.of("CREATE TABLE t (id INT)"); // no source connector -> wrapped error
// after
Config c2 = SqlConfigBuilder.of(
  "CREATE TABLE t WITH ('connector'='fake', 'type'='source') (id INT);\n" +
  "INSERT INTO s SELECT * FROM t;");
Defensive patterns

Strategy: try-catch

Validate before calling

// dry-run the same SQL through the file-based API
Config c = SqlConfigBuilder.of(java.nio.file.Path.of("/tmp/check.sql"));

Try / catch

try { Config c = SqlConfigBuilder.of(sql); } catch (RuntimeException e) { log.error("SQL config invalid", e.getCause()); }

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/f0d957559cf3cf9b. Report an issue: GitHub.