{"record":{"id":"6ac4ab10280056d2","repo":"apache/beam","slug":"this-option-is-only-available-with-extended-error-info","errorCode":null,"errorMessage":"This option is only available with Extended Error Info.","messagePattern":"This option is only available with Extended Error Info\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/JsonToRow.java","lineNumber":249,"sourceCode":"    }\n\n    /**\n     * Sets the field name for the line field in the returned Row.\n     *\n     * @return {@link JsonToRow}\n     */\n    public JsonToRowWithErrFn setLineField(String lineField) {\n      return this.toBuilder().setLineFieldName(lineField).build();\n    }\n\n    /**\n     * Adds the error message to the returned error Row.\n     *\n     * @return {@link JsonToRow}\n     */\n    public JsonToRowWithErrFn setErrorField(String errorField) {\n      if (!this.getExtendedErrorInfo()) {\n        throw new IllegalArgumentException(\n            \"This option is only available with Extended Error Info.\");\n      }\n      return this.toBuilder().setErrorFieldName(errorField).build();\n    }\n\n    /**\n     * Sets the behavior of the deserializer according to {@link NullBehavior}.\n     *\n     * @return {@link JsonToRow}\n     */\n    public JsonToRowWithErrFn withNullBehavior(NullBehavior nullBehavior) {\n      return this.toBuilder().setNullBehavior(nullBehavior).build();\n    }\n\n    @Override\n    public ParseResult expand(PCollection<String> jsonStrings) {\n\n      PCollectionTuple result =","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/JsonToRow.java#L231-L267","documentation":"JsonToRow's JsonToRowWithErrFn builder only supports writing parse errors into a dedicated error field when Extended Error Info is enabled. Calling setErrorField without that option is rejected because the error-field feature would otherwise be meaningless/disabled.","triggerScenarios":"Calling JsonToRowWithErrFn.setErrorField(...) on a builder created without .setExtendedErrorInfo(true) (or the equivalent withExtendedErrorInfo).","commonSituations":"Developers copying the error-handling example but forgetting to enable extended error info; toggling options in different order and hitting validation in the builder.","solutions":["Enable extended error info before setting the error field: JsonToRow.withErrStr(...).withExtendedErrorInfo().setErrorField(\"err\")","Or remove the setErrorField call and rely on the default error reporting without a custom field"],"exampleFix":"// before\nJsonToRow.withErrStr(schema).setErrorField(\"parse_error\");\n// after\nJsonToRow.withErrStr(schema).withExtendedErrorInfo().setErrorField(\"parse_error\");","handlingStrategy":"validation","validationCode":"if (needsErrorField && !builder.getExtendedErrorInfo()) {\n  builder = builder.withExtendedErrorInfo();\n}","typeGuard":"boolean canSetErrorField(JsonToRow.JsonToRowWithErrFn b) {\n  return b.getExtendedErrorInfo();\n}","tryCatchPattern":"try {\n  return builder.setErrorField(\"err\");\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"Extended Error Info\")) {\n    return builder.withExtendedErrorInfo().setErrorField(\"err\");\n  }\n  throw e;\n}","preventionTips":["Always enable withExtendedErrorInfo() before configuring error fields","Read the JsonToRow builder docs for option prerequisites","Keep builder option setup in one helper so prerequisites are enforced in one place"],"tags":["java","apache-beam","configuration"],"backgroundTag":"feature-not-enabled","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"}