{"record":{"id":"f90db14a56b49367","repo":"apache/beam","slug":"s-is-not-nullable-in-field-s","errorCode":null,"errorMessage":"%s is not nullable in  field %s","messagePattern":"(.+?) is not nullable in  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":214,"sourceCode":"          break;\n        case DOUBLE:\n          processedValue = cases.processDouble(rowPosition, (Double) value, this);\n          break;\n        case STRING:\n          processedValue = cases.processString(rowPosition, (String) value, this);\n          break;\n        case BOOLEAN:\n          processedValue = cases.processBoolean(rowPosition, (Boolean) value, this);\n          break;\n        default:\n          // Shouldn't actually get here, but we need this case to satisfy linters.\n          throw new IllegalArgumentException(\n              String.format(\n                  \"Not a primitive type for field name %s: %s\", rowPosition.descriptor, fieldType));\n      }\n      if (processedValue == null) {\n        if (!fieldType.getNullable()) {\n          throw new IllegalArgumentException(\n              String.format(\"%s is not nullable in  field %s\", fieldType, rowPosition.descriptor));\n        }\n      }\n      return processedValue;\n    }\n  }\n\n  static class FieldOverride {\n    FieldOverride(Object overrideValue) {\n      this.overrideValue = overrideValue;\n    }\n\n    Object getOverrideValue() {\n      return overrideValue;\n    }\n\n    final Object overrideValue;\n  }","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/values/RowUtils.java#L196-L232","documentation":"While matching/capturing a Row's field values, the resulting processed value was null but the field's Schema.FieldType is declared non-nullable. Beam Rows enforce nullability declared in the schema, so a null appearing where the schema forbids it is rejected with IllegalArgumentException.","triggerScenarios":"RowUtils.match (via processRow/capturedElement/processMap) encounters null for a field whose FieldType.getNullable() is false — e.g. attaching a schema to values containing null, or a getter returning null for a non-nullable field.","commonSituations":"Declaring fields non-nullable in @DefaultSchema POJOs but leaving the Java field null; pipeline data with missing values fed into Row-based sources; schema evolved to non-nullable while old data still has nulls.","solutions":["Declare the field nullable: Schema.FieldType.<type>().withNullable(true), or annotate/allow null in the POJO","Fix the upstream data so the field is never null (provide defaults before row creation)","Validate/clean records before Row creation, replacing nulls with sentinel/default values"],"exampleFix":"// before\nSchema.Field.of(\"name\", Schema.FieldType.STRING)\n// after (data can contain null)\nSchema.Field.of(\"name\", Schema.FieldType.STRING.withNullable(true))","handlingStrategy":"validation","validationCode":"if (value == null && !fieldType.getNullable()) {\n  value = defaultValue; // or make field nullable\n}","typeGuard":null,"tryCatchPattern":"try { row = Row.withSchema(schema).addValues(...).build(); } catch (IllegalArgumentException e) { log.error(\"schema nullability violation\", e); throw e; }","preventionTips":["Mark POJO fields nullable when data may be absent","Default-fill nulls before Row creation","Keep schema nullability in sync with the actual data contract"],"tags":["java","apache-beam","schema","nullability"],"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"}