apache/seatunnel · error · InvalidConfigurationException

Invalid YAML configuration

Error message

Invalid YAML configuration

What it means

YamlSeaTunnelConfigBuilder.parseAndBuildConfig loads the engine config stream via YamlLoader; if parsing fails (malformed YAML or a root that is not a mapping), it wraps the cause in InvalidConfigurationException("Invalid YAML configuration").

Source

Thrown at seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/config/YamlSeaTunnelConfigBuilder.java:80

        return build(new SeaTunnelConfig());
    }

    public SeaTunnelConfig build(SeaTunnelConfig config) {
        try {
            parseAndBuildConfig(config);
        } catch (Exception e) {
            throw ExceptionUtil.rethrow(e);
        }
        config.setHazelcastConfig(ConfigProvider.locateAndGetMemberConfig(getProperties()));
        return config;
    }

    private void parseAndBuildConfig(SeaTunnelConfig config) throws Exception {
        YamlMapping yamlRootNode;
        try {
            yamlRootNode = (YamlMapping) YamlLoader.load(in);
        } catch (Exception ex) {
            throw new InvalidConfigurationException("Invalid YAML configuration", ex);
        } finally {
            IOUtil.closeResource(in);
        }

        YamlNode seatunnelRoot =
                yamlRootNode.childAsMapping(SeaTunnelConfigSections.SEATUNNEL.name);
        if (seatunnelRoot == null) {
            seatunnelRoot = yamlRootNode;
        }

        YamlDomChecker.check(seatunnelRoot);

        Node w3cRootNode = asW3cNode(seatunnelRoot);
        replaceVariables(w3cRootNode);
        importDocuments(seatunnelRoot);

        new YamlSeaTunnelDomConfigProcessor(true, config).buildConfig(w3cRootNode);
    }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Run yamllint and fix indentation; replace tabs with spaces.
  2. Ensure the document root is a mapping (top-level keys, e.g. seatunnel:), not a list or scalar.
  3. Inspect ex.getCause() for the exact line/column of the parse failure.
  4. Regenerate the config from a known-good template.

Example fix

# before (tab indent - invalid)
seatunnel:
	engine:
# after
seatunnel:
  engine:
Defensive patterns

Strategy: validation

Validate before calling

try (InputStream in = Files.newInputStream(cfgPath)) {
    new org.yaml.snakeyaml.Yaml().load(in);
} catch (Exception e) {
    throw new IllegalStateException("seatunnel.yaml is not valid YAML: " + e.getMessage(), e);
}

Try / catch

try {
    config = new YamlSeaTunnelConfigBuilder(in).build();
} catch (InvalidConfigurationException e) {
    LOG.severe("Invalid YAML configuration: " + e.getCause());
    throw e;
}

Prevention

When it happens

Trigger: build() -> parseAndBuildConfig() where the input stream contains invalid YAML: tabs, bad indentation, truncated document, or a non-mapping root (cast to YamlMapping fails).

Common situations: Hand-edited seatunnel.yaml with tabs or misaligned indents; tool-generated config with scalar root or truncated render; failed download leaving a partial file.

Related errors


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