apache/beam · error · IllegalArgumentException

Failed to convert configuration map to YAML. The following…

Error message

Failed to convert configuration map to YAML. The following keys contain values that cannot be serialized: %s. Please ensure all configuration values are simple types (String, Number, Boolean) or properly structured Maps and Lists. Original error: %s

What it means

Error "Failed to convert configuration map to YAML. The following keys contain values that cannot be serialized: %s. Please ensure all configuration values are simple types (String, Number, Boolean) or properly structured Maps and Lists. Original error: %s" thrown in apache/beam.

Solutions

  1. Ensure all values in the configuration map are simple types (String, Number, Boolean) or nested Maps/Lists; convert custom objects to those shapes first.
  2. Strip or stringify unsupported values (dates, enums, POJOs) before calling yamlStringFromMap.
  3. Catch the YAMLException path and use the reported key list to locate and fix the offending entries, then retry the dump.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/YamlUtils.java:190 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/b268ba8003d73406. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/YamlUtils.java:190

            field ->
                toBeamValue(
                    field, map.get(maybeGetSnakeCase(field.getName(), toCamelCase)), toCamelCase))
        .collect(toRow(rowSchema));
  }

  private static String maybeGetSnakeCase(String str, boolean getSnakeCase) {
    return getSnakeCase ? CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, str) : str;
  }

  public static String yamlStringFromMap(@Nullable Map<String, Object> map) {
    if (map == null || map.isEmpty()) {
      return "";
    }
    try {
      return new Yaml().dumpAsMap(map);
    } catch (YAMLException e) {
      List<String> problematicKeys = findNonSerializableKeys(map);
      throw new IllegalArgumentException(
          String.format(
              "Failed to convert configuration map to YAML. "
                  + "The following keys contain values that cannot be serialized: %s. "
                  + "Please ensure all configuration values are simple types (String, Number, Boolean) "
                  + "or properly structured Maps and Lists. Original error: %s",
              problematicKeys, e.getMessage()),
          e);
    }
  }

  private static List<String> findNonSerializableKeys(Map<String, Object> map) {
    List<String> problematicKeys = new ArrayList<>();
    Yaml yaml = new Yaml();
    for (Map.Entry<String, Object> entry : map.entrySet()) {
      try {
        yaml.dump(entry.getValue());
      } catch (YAMLException e) {
        problematicKeys.add(

View on GitHub (pinned to 12126d8942)