{"record":{"id":"0b8f70adfe2ccd3d","repo":"apache/beam","slug":"value-value-is-out-of-range-for-the-type-of-the-field","errorCode":null,"errorMessage":"Value \"{value}\" is out of range for the type of the field defined in the row schema.","messagePattern":"Value \"(.+?)\" is out of range for the type of the field defined in the row schema\\.","errorType":"validation","errorClass":"UnsupportedRowJsonException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJsonValueExtractors.java","lineNumber":268,"sourceCode":"        .setValidator(JsonNode::isTextual)\n        .build();\n  }\n\n  @AutoValue\n  public abstract static class ValidatingValueExtractor<W> implements ValueExtractor<W> {\n\n    abstract Predicate<JsonNode> validator();\n\n    abstract Function<JsonNode, W> extractor();\n\n    static <T> Builder<T> builder() {\n      return new AutoValue_RowJsonValueExtractors_ValidatingValueExtractor.Builder<>();\n    }\n\n    @Override\n    public W extractValue(JsonNode value) {\n      if (!validator().test(value)) {\n        throw new UnsupportedRowJsonException(\n            \"Value \\\"\"\n                + value.asText()\n                + \"\\\" \"\n                + \"is out of range for the type of the field defined in the row schema.\");\n      }\n\n      return extractor().apply(value);\n    }\n\n    @AutoValue.Builder\n    abstract static class Builder<W> {\n      abstract Builder<W> setValidator(Predicate<JsonNode> validator);\n\n      abstract Builder<W> setExtractor(Function<JsonNode, W> extractor);\n\n      abstract ValidatingValueExtractor<W> build();\n    }\n  }","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJsonValueExtractors.java#L250-L286","documentation":"Thrown by ValidatingValueExtractor.extractValue when a JSON value passes type checks but fails the row-schema validator's predicate (e.g. an integer outside the field's declared range). The library refuses to map values that cannot be represented in the Beam Row schema. The exception message includes the offending value's text representation.","triggerScenarios":"Calling extractValue on a JsonNode whose value is outside the allowed range for the schema field type, e.g. a JSON number larger than a Long field can hold, or a value failing the validator predicate configured for the extractor.","commonSituations":"Converting JSON documents into Beam Rows where a field contains a number beyond the declared schema type (e.g. a huge integer against an INT64 field), or string/numeric values that violate schema constraints during data ingestion from JSON sources.","solutions":["Check the value at the offending record against the row schema field type and widen the schema field type (e.g. INT32 -> INT64) if the data legitimately exceeds the range.","Pre-filter or sanitize the JSON data before conversion so out-of-range values are rejected, defaulted, or clamped upstream.","Catch UnsupportedRowJsonException and route the bad record to a dead-letter output for inspection."],"exampleFix":"// before\nRow row = rowJsonConverter.convert(jsonNode); // throws for huge numbers\n// after\nif (jsonNode.get(\"count\").canConvertToLong()) {\n  Row row = rowJsonConverter.convert(jsonNode);\n} else {\n  deadLetterOutput.output(jsonNode.toString());\n}","handlingStrategy":"validation","validationCode":"boolean inRange = jsonNode.canConvertToInt() /* or canConvertToLong() */;\nif (!inRange) { deadLetter(jsonNode); return; }","typeGuard":null,"tryCatchPattern":"try { row = extractor.extractValue(node); } catch (UnsupportedRowJsonException e) { deadLetterOutput.output(node.toString()); }","preventionTips":["Define row schema field types wide enough for the source JSON data.","Validate sample data against the schema before full pipeline runs.","Route schema-violating records to a dead-letter sink instead of failing the pipeline."],"tags":["java","beam","schema","data-conversion","json"],"backgroundTag":"value-out-of-range","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"}