{"record":{"id":"e2f9b2efb2aee4be","repo":"apache/seatunnel","slug":"invalid-yaml-configuration","errorCode":null,"errorMessage":"Invalid YAML configuration","messagePattern":"Invalid YAML configuration","errorType":"exception","errorClass":"InvalidConfigurationException","httpStatus":null,"severity":"error","filePath":"seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/config/YamlSeaTunnelConfigBuilder.java","lineNumber":80,"sourceCode":"        return build(new SeaTunnelConfig());\n    }\n\n    public SeaTunnelConfig build(SeaTunnelConfig config) {\n        try {\n            parseAndBuildConfig(config);\n        } catch (Exception e) {\n            throw ExceptionUtil.rethrow(e);\n        }\n        config.setHazelcastConfig(ConfigProvider.locateAndGetMemberConfig(getProperties()));\n        return config;\n    }\n\n    private void parseAndBuildConfig(SeaTunnelConfig config) throws Exception {\n        YamlMapping yamlRootNode;\n        try {\n            yamlRootNode = (YamlMapping) YamlLoader.load(in);\n        } catch (Exception ex) {\n            throw new InvalidConfigurationException(\"Invalid YAML configuration\", ex);\n        } finally {\n            IOUtil.closeResource(in);\n        }\n\n        YamlNode seatunnelRoot =\n                yamlRootNode.childAsMapping(SeaTunnelConfigSections.SEATUNNEL.name);\n        if (seatunnelRoot == null) {\n            seatunnelRoot = yamlRootNode;\n        }\n\n        YamlDomChecker.check(seatunnelRoot);\n\n        Node w3cRootNode = asW3cNode(seatunnelRoot);\n        replaceVariables(w3cRootNode);\n        importDocuments(seatunnelRoot);\n\n        new YamlSeaTunnelDomConfigProcessor(true, config).buildConfig(w3cRootNode);\n    }","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/config/YamlSeaTunnelConfigBuilder.java#L62-L98","documentation":"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\").","triggerScenarios":"build() -> parseAndBuildConfig() where the input stream contains invalid YAML: tabs, bad indentation, truncated document, or a non-mapping root (cast to YamlMapping fails).","commonSituations":"Hand-edited seatunnel.yaml with tabs or misaligned indents; tool-generated config with scalar root or truncated render; failed download leaving a partial file.","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."],"exampleFix":"# before (tab indent - invalid)\nseatunnel:\n\tengine:\n# after\nseatunnel:\n  engine:","handlingStrategy":"validation","validationCode":"try (InputStream in = Files.newInputStream(cfgPath)) {\n    new org.yaml.snakeyaml.Yaml().load(in);\n} catch (Exception e) {\n    throw new IllegalStateException(\"seatunnel.yaml is not valid YAML: \" + e.getMessage(), e);\n}","typeGuard":null,"tryCatchPattern":"try {\n    config = new YamlSeaTunnelConfigBuilder(in).build();\n} catch (InvalidConfigurationException e) {\n    LOG.severe(\"Invalid YAML configuration: \" + e.getCause());\n    throw e;\n}","preventionTips":["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."],"tags":["yaml","config","parse"],"backgroundTag":"yaml-parse-error","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}