{"record":{"id":"349f334389c2d77d","repo":"apache/beam","slug":"s-is-not-nullable-in-array-field-s","errorCode":null,"errorMessage":"%s is not nullable in Array field %s","messagePattern":"(.+?) is not nullable in Array field (.+?)","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/values/RowUtils.java","lineNumber":485,"sourceCode":"      }\n      return retValue;\n    }\n\n    private Collection<Object> captureIterable(\n        RowPosition rowPosition,\n        FieldType collectionElementType,\n        Iterable<Object> values,\n        RowFieldMatcher matcher) {\n      if (values == null) {\n        return null;\n      }\n\n      List<Object> captured = Lists.newArrayListWithCapacity(Iterables.size(values));\n      RowPosition elementPosition = rowPosition.withArrayQualifier();\n      for (Object listValue : values) {\n        if (listValue == null) {\n          if (!collectionElementType.getNullable()) {\n            throw new IllegalArgumentException(\n                String.format(\n                    \"%s is not nullable in Array field %s\",\n                    collectionElementType, rowPosition.descriptor));\n          }\n          captured.add(null);\n        } else {\n          Object capturedElement =\n              matcher.match(this, collectionElementType, elementPosition, listValue);\n          captured.add(capturedElement);\n        }\n      }\n      return captured;\n    }\n\n    @Override\n    public Map<Object, Object> processMap(\n        RowPosition rowPosition,\n        FieldType keyType,","sourceCodeStart":467,"sourceCodeEnd":503,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/values/RowUtils.java#L467-L503","documentation":"Beam Row schemas can declare whether array/iterable elements are nullable. When capturing an iterable field, a null element was found although the element type is declared non-nullable, so captureIterable throws IllegalArgumentException. Note: the top-level collection itself may be null per its own nullability, but individual elements must respect the element type's nullable flag.","triggerScenarios":"RowUtils.captureIterable (called from processArray/processIterable during schema attach/match) iterating values and hitting a null element while collectionElementType.getNullable() is false.","commonSituations":"Lists built from data with missing entries (e.g. Arrays.asList(\"a\", null)); deserialized data that predates a nullability change; building Rows from joins/lookups that return null elements.","solutions":["Declare array elements nullable: Schema.FieldType.array(Schema.FieldType.STRING.withNullable(true))","Filter or replace null elements before building the Row (e.g. lists.transform, Iterables.filter(Objects::nonNull))","Fix the data-producing step so null elements never enter the collection"],"exampleFix":"// before\nList<String> tags = Arrays.asList(\"a\", null);\n// after\nList<String> tags = Streams.stream(rawTags).filter(Objects::nonNull).collect(Collectors.toList());","handlingStrategy":"validation","validationCode":"if (list.contains(null) && !elementType.getNullable()) {\n  list = list.stream().filter(Objects::nonNull).collect(Collectors.toList());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Filter nulls from collections before building Rows","Declare element types nullable when nulls are possible","Check upstream producers for null elements"],"tags":["java","apache-beam","schema","nullability","array"],"backgroundTag":"null-value-in-non-nullable-field","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"}