apache/seatunnel · error · RuntimeException

Failed to parse job config file: <path>

Error message

Failed to parse job config file: <path>

What it means

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.

Source

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

import static org.apache.seatunnel.config.sql.utils.Constant.OPTION_TABLE_TYPE_SINK;
import static org.apache.seatunnel.config.sql.utils.Constant.OPTION_TABLE_TYPE_SOURCE;
import static org.apache.seatunnel.config.sql.utils.Constant.OPTION_TABLE_TYPE_TRANSFORM;
import static org.apache.seatunnel.config.sql.utils.Constant.SQL_ANNOTATION_PREFIX;
import static org.apache.seatunnel.config.sql.utils.Constant.SQL_ANNOTATION_PREFIX2;
import static org.apache.seatunnel.config.sql.utils.Constant.SQL_ANNOTATION_SUFFIX;
import static org.apache.seatunnel.config.sql.utils.Constant.SQL_CONFIG_ANNOTATION_PREFIX;
import static org.apache.seatunnel.config.sql.utils.Constant.SQL_DELIMITER;
import static org.apache.seatunnel.config.sql.utils.Constant.TEMP_TABLE_SUFFIX;

@Slf4j
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();

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Read the 'Caused by' of the stack trace to find the real error (NoSuchFileException vs SQL parse error).
  2. Verify the file path exists and is readable: ls -l <path> and use an absolute path.
  3. Validate the SQL content with the string-based of(String) to isolate file I/O from parsing.
  4. Fix SQL syntax errors reported in the cause before re-running.

Example fix

// before
Config c = SqlConfigBuilder.of(Paths.get("job.sql")); // file missing -> RuntimeException
// after
Path p = Paths.get("/abs/path/job.sql");
if (!Files.isRegularFile(p)) {
    throw new IllegalArgumentException("Config file not found: " + p);
}
Config c2 = SqlConfigBuilder.of(p);
Defensive patterns

Strategy: try-catch

Validate before calling

if (!java.nio.file.Files.isRegularFile(path) || !java.nio.file.Files.isReadable(path)) throw new IllegalArgumentException("Bad config path: " + path);

Try / catch

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); }

Prevention

When it happens

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

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

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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