apache/beam · error · IllegalArgumentException

Expected each entry in the allowlist to include the…

Error message

Expected each entry in the allowlist to include the 'className'

What it means

parseFromYamlStream walks each entry under allowedClasses in the allowlist YAML and found an entry lacking the mandatory 'className' key. The allowlist YAML stream is the faulty input: every allowedClasses item must carry className (plus optional builder/constructor method filters) to identify the class being allowed.

Solutions

  1. Add a 'className' string to every entry under allowedClasses.
  2. Check key casing: it must be exactly 'className'.
  3. Diff your allowlist against a known-good example from Beam docs.

Example fix

# before
allowedClasses:
  - classname: org.example.MyTransform
# after
allowedClasses:
  - className: org.example.MyTransform
Defensive patterns

Strategy: validation

Validate before calling

Map<Object,Object> cfg = new Yaml().load(stream);
List<?> entries = (List<?>) cfg.get("allowedClasses");
for (Object e : entries) {
  if (!(e instanceof Map) || ((Map<?,?>) e).get("className") == null)
    throw new IllegalArgumentException("allowedClasses entry missing 'className'");
}

Type guard

boolean entryHasClassName(Map<Object,Object> entry) { return entry.get("className") instanceof String && !((String) entry.get("className")).isEmpty(); }

Try / catch

try { AllowList list = AllowList.parseFromYamlStream(stream); } catch (IllegalArgumentException e) { log.error("Malformed allowlist entry: {}", e.getMessage()); throw new InvalidConfigException(e); }

Prevention

When it happens

Trigger: Parsing an allowlist YAML where an allowedClasses list element omits 'className', misspells it ('classname', 'class_name'), or its value is not a String.

Common situations: Hand-edited allowlist files, copy-pasted examples with renamed fields, YAML anchor merges dropping the key.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at sdks/java/expansion-service/src/main/java/org/apache/beam/sdk/expansion/service/JavaClassLookupTransformProvider.java:511

      Yaml yaml = new Yaml();
      Map<Object, Object> config = yaml.load(inputStream);

      if (config == null) {
        throw new IllegalArgumentException(
            "Could not parse the provided YAML stream into a non-trivial AllowList");
      }

      String version = config.get("version") != null ? (String) config.get("version") : "";
      List<AllowedClass> allowedClasses = new ArrayList<>();
      if (config.get("allowedClasses") != null) {
        allowedClasses =
            ((List<Map<Object, Object>>) config.get("allowedClasses"))
                .stream()
                    .map(
                        data -> {
                          String className = (String) data.get("className");
                          if (className == null) {
                            throw new IllegalArgumentException(
                                "Expected each entry in the allowlist to include the 'className'");
                          }
                          List<String> allowedBuilderMethods =
                              (List<String>) data.get("allowedBuilderMethods");
                          List<String> allowedConstructorMethods =
                              (List<String>) data.get("allowedConstructorMethods");
                          if (allowedBuilderMethods == null) {
                            allowedBuilderMethods = new ArrayList<>();
                          }
                          if (allowedConstructorMethods == null) {
                            allowedConstructorMethods = new ArrayList<>();
                          }
                          return AllowedClass.create(
                              className, allowedBuilderMethods, allowedConstructorMethods);
                        })
                    .collect(Collectors.toList());
      }
      return AllowList.create(version, allowedClasses);

View on GitHub (pinned to 12126d8942)