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
- Run yamllint and fix indentation; replace tabs with spaces.
- Ensure the document root is a mapping (top-level keys, e.g. seatunnel:), not a list or scalar.
- Inspect ex.getCause() for the exact line/column of the parse failure.
- 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
- Run yamllint on config files in CI.
- Ban tabs; enforce 2-space indentation.
- Always inspect getCause() for the parse location.
- Validate rendered templates produce mapping-rooted YAML.
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
- input must be defined.
- input must be defined.
- input.queue is no longer supported; configure top-level queu
- Agent config is not a readable file: ${yamlPath}
- provided string configuration is null or empty! Please use a
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/e2f9b2efb2aee4be.
Report an issue: GitHub.