{"record":{"id":"b4f84cc048514b77","repo":"apache/beam","slug":"could-not-parse-the-provided-yaml-stream-into-a-non-trivial-b4f84c","errorCode":null,"errorMessage":"Could not parse the provided YAML stream into a non-trivial TransformServiceConfig","messagePattern":"Could not parse the provided YAML stream into a non-trivial TransformServiceConfig","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/transform-service/src/main/java/org/apache/beam/sdk/transformservice/TransformServiceConfig.java","lineNumber":47,"sourceCode":"  public abstract List<String> getExpansionservices();\n\n  public static TransformServiceConfig empty() {\n    return create(new ArrayList<>());\n  }\n\n  static TransformServiceConfig create(List<String> expansionservices) {\n    if (expansionservices == null) {\n      expansionservices = new ArrayList<>();\n    }\n\n    return new AutoValue_TransformServiceConfig(expansionservices);\n  }\n\n  static TransformServiceConfig parseFromYamlStream(InputStream inputStream) {\n    Yaml yaml = new Yaml();\n    Map<Object, Object> config = yaml.load(inputStream);\n    if (config == null) {\n      throw new IllegalArgumentException(\n          \"Could not parse the provided YAML stream into a non-trivial TransformServiceConfig\");\n    }\n\n    List<String> expansionservices = null;\n    if (config.get(\"expansionservices\") != null) {\n      expansionservices = (List<String>) config.get(\"expansionservices\");\n    }\n\n    if (expansionservices == null) {\n      throw new IllegalArgumentException(\n          \"Expected the Transform Service config to contain at least one Expansion Service.\");\n    }\n\n    return TransformServiceConfig.create(expansionservices);\n  }\n}\n","sourceCodeStart":29,"sourceCodeEnd":64,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/transform-service/src/main/java/org/apache/beam/sdk/transformservice/TransformServiceConfig.java#L29-L64","documentation":"Thrown by TransformServiceConfig.parseFromYamlStream when the YAML stream deserializes to null — i.e. the file parsed as YAML but contained no meaningful mapping. A TransformServiceConfig must be a non-empty mapping (at minimum an 'expansionservices' key).","triggerScenarios":"Passing an InputStream whose content is empty, only comments, only whitespace, or a YAML document consisting solely of 'null' to parseFromYamlStream (directly or via a config file provided through TransformServiceOptions).","commonSituations":"Config file created but left empty; file contains only comments ('# ...'); YAML was truncated or the wrong file was passed.","solutions":["Add content to the YAML file, starting with an 'expansionservices' list.","Check the file was not truncated — verify with 'cat' that it holds the full config.","Ensure you are pointing at the intended config file path."],"exampleFix":"// before: empty config file\n# my service config (nothing else)\n// after: valid config file\nexpansionservices:\n  - \"localhost:12345\"","handlingStrategy":"validation","validationCode":"import org.yaml.snakeyaml.Yaml;\nstatic void validateConfigYaml(String path) throws IOException {\n  try (InputStream in = new FileInputStream(path)) {\n    Object parsed = new Yaml().load(in);\n    if (!(parsed instanceof Map) || ((Map<?, ?>) parsed).isEmpty()) {\n      throw new IllegalArgumentException(path + \" is empty or not a YAML mapping\");\n    }\n  }\n}","typeGuard":"boolean isNonEmptyYamlMapping(InputStream in) {\n  Object o = new Yaml().load(in);\n  return o instanceof Map && !((Map<?, ?>) o).isEmpty();\n}","tryCatchPattern":"try {\n  config = TransformServiceConfig.parseFromYamlStream(stream);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"non-trivial TransformServiceConfig\")) {\n    throw new IllegalArgumentException(\"Config file is empty; add an 'expansionservices' section.\", e);\n  }\n  throw e;\n}","preventionTips":["Never ship an empty or comment-only YAML config file.","Lint the YAML file (non-null mapping) as part of your build/deploy.","Verify file contents with cat before launching the pipeline."],"tags":["java","yaml","configuration","validation"],"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"}