apache/beam · error · IllegalArgumentException
This option is only available with Extended Error Info.
Error message
This option is only available with Extended Error Info.
What it means
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.
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
Example fix
// before
JsonToRow.withErrStr(schema).setErrorField("parse_error");
// after
JsonToRow.withErrStr(schema).withExtendedErrorInfo().setErrorField("parse_error"); Defensive patterns
Strategy: validation
Validate before calling
if (needsErrorField && !builder.getExtendedErrorInfo()) {
builder = builder.withExtendedErrorInfo();
} Type guard
boolean canSetErrorField(JsonToRow.JsonToRowWithErrFn b) {
return b.getExtendedErrorInfo();
} Try / catch
try {
return builder.setErrorField("err");
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("Extended Error Info")) {
return builder.withExtendedErrorInfo().setErrorField("err");
}
throw e;
} Prevention
- 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
When it happens
Trigger: Calling JsonToRowWithErrFn.setErrorField(...) on a builder created without .setExtendedErrorInfo(true) (or the equivalent withExtendedErrorInfo).
Common situations: Developers copying the error-handling example but forgetting to enable extended error info; toggling options in different order and hitting validation in the builder.
Related errors
- A schema was provided without a data format (or viceversa)…
- Batch size is too large! It should be smaller or equal than
- boolean cross product parameter required to explode more…
- Both numFileShards and auto-sharding options are set. Will…
- Both numStorageWriteApiStreams and auto-sharding options…
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/6ac4ab10280056d2.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/JsonToRow.java:249
}
/**
* Sets the field name for the line field in the returned Row.
*
* @return {@link JsonToRow}
*/
public JsonToRowWithErrFn setLineField(String lineField) {
return this.toBuilder().setLineFieldName(lineField).build();
}
/**
* Adds the error message to the returned error Row.
*
* @return {@link JsonToRow}
*/
public JsonToRowWithErrFn setErrorField(String errorField) {
if (!this.getExtendedErrorInfo()) {
throw new IllegalArgumentException(
"This option is only available with Extended Error Info.");
}
return this.toBuilder().setErrorFieldName(errorField).build();
}
/**
* Sets the behavior of the deserializer according to {@link NullBehavior}.
*
* @return {@link JsonToRow}
*/
public JsonToRowWithErrFn withNullBehavior(NullBehavior nullBehavior) {
return this.toBuilder().setNullBehavior(nullBehavior).build();
}
@Override
public ParseResult expand(PCollection<String> jsonStrings) {
PCollectionTuple result =View on GitHub (pinned to 12126d8942)