{"record":{"id":"56045eb1e9a9e5cb","repo":"apache/beam","slug":"could-not-parse-the-provided-yaml-stream-into-a-non-trivial","errorCode":null,"errorMessage":"Could not parse the provided YAML stream into a non-trivial ExpansionServiceConfig","messagePattern":"Could not parse the provided YAML stream into a non-trivial ExpansionServiceConfig","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/expansion-service/src/main/java/org/apache/beam/sdk/expansion/service/ExpansionServiceConfig.java","lineNumber":54,"sourceCode":"\n  public static ExpansionServiceConfig empty() {\n    return create(new ArrayList<>(), new HashMap<>());\n  }\n\n  public static ExpansionServiceConfig create(\n      List<String> allowlist, Map<String, List<Dependency>> dependencies) {\n    if (allowlist == null) {\n      allowlist = new ArrayList<>();\n    }\n    return new AutoValue_ExpansionServiceConfig(allowlist, dependencies);\n  }\n\n  static ExpansionServiceConfig parseFromYamlStream(InputStream inputStream) {\n    Yaml yaml = new Yaml();\n    Map<Object, Object> config = yaml.load(inputStream);\n\n    if (config == null) {\n      throw new IllegalArgumentException(\n          \"Could not parse the provided YAML stream into a non-trivial ExpansionServiceConfig\");\n    }\n\n    List<String> allowList = new ArrayList<>();\n    Map<String, List<Dependency>> dependencies = new HashMap<>();\n    if (config.get(\"allowlist\") != null) {\n      allowList = (List<String>) config.get(\"allowlist\");\n    }\n\n    if (config.get(\"dependencies\") != null) {\n      Map<String, List<Object>> dependenciesFromConfig =\n          (Map<String, List<Object>>) config.get(\"dependencies\");\n      dependenciesFromConfig.forEach(\n          (k, v) -> {\n            if (v != null) {\n              List<Dependency> dependenciesForTransform =\n                  v.stream()\n                      .map(","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/expansion-service/src/main/java/org/apache/beam/sdk/expansion/service/ExpansionServiceConfig.java#L36-L72","documentation":"Thrown by ExpansionServiceConfig.parseFromYamlStream when the YAML input deserializes to null — meaning the stream was empty or contained only comments/whitespace — so no non-trivial ExpansionServiceConfig can be built. The service requires at least a mapping node to read allowlist/dependency entries from.","triggerScenarios":"Passing an empty file, an empty InputStream, or a YAML file containing only comments to parseFromYamlStream, or wiring the config-file provider at a path that resolves to a zero-byte file.","commonSituations":"Config file created but never populated; wrong file mounted in a container so the target path is empty; redirection created an empty file (e.g. 'touch config.yaml').","solutions":["Add valid content to the YAML file, e.g. an allowlist mapping: 'allowlist: [\"org.apache.beam.sdk.transforms.*\"]'.","Point --expansionServiceConfigFile at the correct, non-empty file.","Check the file with 'cat' (or 'wc -c') to confirm it has content before starting the service."],"exampleFix":"// before: config.yaml is empty\n// after: config.yaml\nallowlist:\n  - \"org.apache.beam.sdk.schemas.transforms.*\"\ndependencies: {}","handlingStrategy":"validation","validationCode":"File f = new File(configPath);\nif (!f.exists() || f.length() == 0) {\n  throw new IllegalStateException(\"Expansion service config file is missing or empty: \" + configPath);\n}","typeGuard":null,"tryCatchPattern":"try {\n  cfg = ExpansionServiceConfig.parseFromYamlStream(stream);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"non-trivial\")) { /* supply a non-empty YAML mapping */ }\n  throw e;\n}","preventionTips":["Validate YAML content with a quick parse (snakeyaml load) in CI before deployment.","Never deploy zero-byte config files; fail the build if the config is empty.","Check file size (>0) after volume mounts come up in containers."],"tags":["java","yaml","config","empty-input"],"backgroundTag":"yaml-parse-error","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}