{"record":{"id":"ffc744b27ac6d002","repo":"apache/beam","slug":"unable-to-parse-json-value","errorCode":null,"errorMessage":"Unable to parse JSON value ","messagePattern":"Unable to parse JSON value ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/options/PipelineOptionsFactory.java","lineNumber":1964,"sourceCode":"          if (values.contains(\"\")) {\n            checkEmptyStringAllowed(returnType, type, method.getGenericReturnType().toString());\n          }\n          convertedOptions.put(entry.getKey(), MAPPER.convertValue(values, type));\n        } else if (isSimpleType(returnType, type)) {\n          String value = Iterables.getOnlyElement(entry.getValue());\n          if (value.isEmpty()) {\n            checkEmptyStringAllowed(returnType, type, method.getGenericReturnType().toString());\n          }\n          convertedOptions.put(entry.getKey(), MAPPER.convertValue(value, type));\n        } else {\n          String value = Iterables.getOnlyElement(entry.getValue());\n          if (value.isEmpty()) {\n            checkEmptyStringAllowed(returnType, type, method.getGenericReturnType().toString());\n          }\n          try {\n            convertedOptions.put(entry.getKey(), tryParseObject(value, method));\n          } catch (IOException e) {\n            throw new IllegalArgumentException(\"Unable to parse JSON value \" + value, e);\n          }\n        }\n      } catch (IllegalArgumentException e) {\n        if (strictParsing) {\n          throw e;\n        } else {\n          LOG.warn(\n              \"Strict parsing is disabled, ignoring option '{}' with value '{}'\",\n              entry.getKey(),\n              entry.getValue(),\n              e);\n        }\n      }\n    }\n    return convertedOptions;\n  }\n\n  /**","sourceCodeStart":1946,"sourceCodeEnd":1982,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/options/PipelineOptionsFactory.java#L1946-L1982","documentation":"A JSON string value supplied for an option could not be parsed into the property's type by tryParseObject; the IOException is wrapped in an IllegalArgumentException prefixed with 'Unable to parse JSON value '. In non-strict mode the error is swallowed, so this surfaces only with strict parsing enabled.","triggerScenarios":"Providing malformed JSON for a structured/list/complex option (e.g., --opt={a,b} instead of {\"a\":\"b\"}) while strictParsing is true, when converting args or a JSON options map.","commonSituations":"Unquoted or unescaped JSON on the command line; nested quotes mangled by shell escaping; passing a plain string where a JSON array/object is expected.","solutions":["Fix the JSON syntax of the value (quote keys, balance braces/brackets)","Escape quotes properly for your shell (single-quote the whole --arg=value token)","Set the option programmatically on the options interface instead of via JSON string"],"exampleFix":"// before\n--inputFiles=[file1.txt, file2.txt]\n// after\n--inputFiles='[\"file1.txt\",\"file2.txt\"]'","handlingStrategy":"validation","validationCode":"new ObjectMapper().readTree(rawValue); // throws JsonProcessingException early if malformed","typeGuard":null,"tryCatchPattern":"try { fromArgs(args).as(Opts.class); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Unable to parse JSON\")) { /* fix value format */ } }","preventionTips":["Single-quote JSON flags in shell to avoid mangling","Round-trip test complex option values with Jackson before passing them","Prefer programmatic setters for structured options"],"tags":["java","apache-beam","json","cli","parsing"],"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"}