apache/flink · critical · RuntimeException

Error parsing YAML configuration.

Error message

Error parsing YAML configuration.

What it means

Thrown by GlobalConfiguration.loadYAMLResource as a RuntimeException wrapping any exception caught while parsing the flink-conf.yaml file. The inner cause is the actual parse error (YAML syntax error, type coercion failure, etc.). This is a catch-all that masks the root cause behind a generic message.

Source

Thrown at flink-core/src/main/java/org/apache/flink/configuration/GlobalConfiguration.java:264

     *         port: 6123         # network port to connect to for communication with the job manager
     * taskmanager:
     *     rpc:
     *         port: 6122         # network port the task manager expects incoming IPC connections
     * </pre>
     *
     * @param file the YAML file to read from
     * @see <a href="http://www.yaml.org/spec/1.2/spec.html">YAML 1.2 specification</a>
     */
    private static Configuration loadYAMLResource(File file) {
        final Configuration config = new Configuration();

        try {
            Map<String, Object> configDocument = flatten(YamlParserUtils.loadYamlFile(file));
            configDocument.forEach((k, v) -> config.setValueInternal(k, v, false));

            return config;
        } catch (Exception e) {
            throw new RuntimeException("Error parsing YAML configuration.", e);
        }
    }

    /**
     * Check whether the key is a hidden key.
     *
     * @param key the config key
     * @param additionalKeys user-defined additional sensitive key substrings to check in addition
     *     to the built-in list; use {@link SecurityOptions#ADDITIONAL_SENSITIVE_KEYS} to obtain
     *     these from a loaded {@link Configuration}
     */
    public static boolean isSensitive(String key, List<String> additionalKeys) {
        Preconditions.checkNotNull(key, "key is null");
        final String keyInLower = key.toLowerCase();
        for (String hideKey : SENSITIVE_KEYS) {
            if (keyInLower.length() >= hideKey.length() && keyInLower.contains(hideKey)) {
                return true;
            }

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Examine the cause of the RuntimeException to find the exact YAML line and error.
  2. Validate the YAML with a linter (e.g., yamllint or an online parser) before deploying.
  3. Quote values containing special characters (:, {, }, [, ], ,, &, *, #, ?, |, <, >, =, %, @).
  4. Use spaces consistently; avoid tabs for indentation.

Example fix

# before (tab indentation / bad nesting)
jobmanager:
	memory:
	  process.size: 1600m

# after
jobmanager:
  memory:
    process:
      size: 1600m
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-validate YAML with snakeyaml before Flink loads it
org.yaml.snakeyaml.Yaml yaml = new org.yaml.snakeyaml.Yaml();
try (InputStream is = Files.newInputStream(Paths.get(yamlPath))) {
    yaml.load(is); // throws on syntax errors
} catch (Exception e) { /* report line number */ }

Try / catch

try {
    Configuration conf = GlobalConfiguration.loadConfiguration(configDir);
} catch (RuntimeException e) {
    if (e.getMessage().equals("Error parsing YAML configuration.") && e.getCause() != null) {
        Throwable cause = e.getCause();
        // inspect cause for line/column info
    }
}

Prevention

When it happens

Trigger: Malformed YAML syntax (bad indentation, stray tabs, unbalanced brackets). A value that fails type coercion during setValueInternal. Unsupported YAML constructs (anchors, tags) the parser cannot handle.

Common situations: Hand-editing flink-conf.yaml with incorrect indentation. Mixing tabs and spaces. Copy-pasting config snippets with invalid YAML. Values containing special characters that need quoting.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/80a6953c730dc661. Report an issue: GitHub.