{"record":{"id":"0b1c193965b3e495","repo":"apache/beam","slug":"unable-to-parse-s","errorCode":null,"errorMessage":"Unable to parse %s","messagePattern":"Unable to parse (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/options/ValueProviders.java","lineNumber":46,"sourceCode":"  private ValueProviders() {}\n\n  /**\n   * Given {@code serializedOptions} as a JSON-serialized {@link PipelineOptions}, updates the\n   * values according to the provided values in {@code runtimeValues}.\n   *\n   * @deprecated Use {@link org.apache.beam.sdk.testing.TestPipeline#newProvider} for testing {@link\n   *     ValueProvider} code.\n   */\n  @Deprecated\n  public static String updateSerializedOptions(\n      String serializedOptions, Map<String, String> runtimeValues) {\n    ObjectNode root, options;\n    try {\n      root = PipelineOptionsFactory.MAPPER.readValue(serializedOptions, ObjectNode.class);\n      options = (ObjectNode) root.get(\"options\");\n      checkStateNotNull(options, \"Unable to locate 'options' in %s\", serializedOptions);\n    } catch (IOException e) {\n      throw new RuntimeException(String.format(\"Unable to parse %s\", serializedOptions), e);\n    }\n\n    for (Map.Entry<String, String> entry : runtimeValues.entrySet()) {\n      options.put(entry.getKey(), entry.getValue());\n    }\n    try {\n      return PipelineOptionsFactory.MAPPER.writeValueAsString(root);\n    } catch (IOException e) {\n      throw new RuntimeException(\"Unable to parse re-serialize options\", e);\n    }\n  }\n}\n","sourceCodeStart":28,"sourceCodeEnd":59,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/options/ValueProviders.java#L28-L59","documentation":"updateSerializedOptions parses a serialized PipelineOptions JSON, expecting an object with an 'options' member. This error wraps any IOException from Jackson while reading that JSON (or the ObjectNode conversion), e.g. malformed JSON or a non-object document. It lets callers know the runtime value-provider template string could not be parsed.","triggerScenarios":"Calling ValueProviders.updateSerializedOptions(serializedOptions, runtimeValues) where serializedOptions is not valid JSON or cannot be read as an ObjectNode — e.g. a corrupted or hand-edited template serialization, or a string that is not the output of PipelineOptionsFactory serialization.","commonSituations":"Templated Dataflow pipelines where the --options serialization was truncated or altered by shell escaping; passing a plain string/URL instead of the serialized options JSON; version mismatch producing JSON with unexpected top-level structure.","solutions":["Validate the serializedOptions string is well-formed JSON and has a top-level 'options' object before calling.","Regenerate the serialization with PipelineOptionsFactory.as(...).toString() / the SDK's serializer instead of hand-crafting it.","Inspect the wrapped IOException cause for the exact parse failure position and fix that offset.","If the string comes from a template parameter, ensure the template engine did not HTML-escape or mangle quotes."],"exampleFix":"// before\nString opts = \"pipeline-args\"; // not JSON\nValueProviders.updateSerializedOptions(opts, values);\n\n// after\nString opts = PipelineOptionsFactory.fromArgs(args).as(MyOptions.class).toString();\nValueProviders.updateSerializedOptions(opts, values);","handlingStrategy":"validation","validationCode":"new ObjectMapper().readTree(serializedOptions).withArrayOrObject(\"options\"); // fail fast if not an object with 'options'","typeGuard":"static boolean isOptionsTemplate(String s) {\n  try { return new ObjectMapper().readTree(s).has(\"options\"); } catch (Exception e) { return false; }\n}","tryCatchPattern":"try { ValueProviders.updateSerializedOptions(opts, values); }\ncatch (RuntimeException e) {\n  // cause is IOException from Jackson\n  throw new IllegalArgumentException(\"Bad serialized options template\", e.getCause());\n}","preventionTips":["Generate the template via the SDK's own serialization, never hand-write it","Beware shell/HTML escaping of the template string in pipeline args","Sanity-check the JSON in CI before launching templated pipelines"],"tags":["json","parsing","pipeline-options","template"],"backgroundTag":"json-parse-error","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}