{"record":{"id":"e42f129cf5d657a4","repo":"apache/beam","slug":"required-org-apache-beam-sdk-schemas-schema-field-has-null","errorCode":null,"errorMessage":"Required org.apache.beam.sdk.schemas.Schema field  has null value","messagePattern":"Required org\\.apache\\.beam\\.sdk\\.schemas\\.Schema field  has null value","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/csv/src/main/java/org/apache/beam/sdk/io/csv/CsvIORecordToObjects.java","lineNumber":117,"sourceCode":"      } catch (RuntimeException e) {\n        receiver\n            .get(errorTag)\n            .output(\n                CsvIOParseError.builder()\n                    .setCsvRecord(record.toString())\n                    .setMessage(Optional.ofNullable(e.getMessage()).orElse(\"\"))\n                    .setStackTrace(Throwables.getStackTraceAsString(e))\n                    .setObservedTimestamp(Instant.now())\n                    .build());\n      }\n    }\n  }\n\n  /** Parses cell to emit the value, as well as potential errors with filename. */\n  Object parseCell(String cell, Schema.Field field) {\n    if (cell == null) {\n      if (!field.getType().getNullable()) {\n        throw new IllegalArgumentException(\n            \"Required org.apache.beam.sdk.schemas.Schema field \"\n                + field.getName()\n                + \" has null value\");\n      }\n      return cell;\n    }\n    if (customProcessingMap.containsKey(field.getName())) {\n      return customProcessingMap.get(field.getName()).apply(cell);\n    }\n    return CsvIOParseHelpers.parseCell(cell, field);\n  }\n}\n","sourceCodeStart":99,"sourceCodeEnd":130,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/csv/src/main/java/org/apache/beam/sdk/io/csv/CsvIORecordToObjects.java#L99-L130","documentation":"CsvIORecordToObjects.parseCell() throws IllegalArgumentException when a CSV cell is null but the corresponding Schema.Field is declared non-nullable. In CSV parsing a null cell typically comes from a missing/short record, and Beam enforces the schema's nullability contract at row-parse time.","triggerScenarios":"Parsing a CSV record whose row has fewer columns than the header (null padding) while the field at that position is non-nullable in the schema.","commonSituations":"Truncated or ragged CSV lines from manual edits or partial exports; nullable flag removed from the schema after data files were already produced with missing values.","solutions":["Declare the field nullable: FieldType.STRING.withNullable(true), if missing values are acceptable.","Repair or filter short/malformed rows before parsing.","Use a custom record parser to supply a default value for missing cells."],"exampleFix":"// before: non-nullable field receives null from a short row\n// after\nSchema.Field.of(\"optionalNote\", FieldType.STRING.withNullable(true));","handlingStrategy":"try-catch","validationCode":"// ensure every row has as many columns as the header\nif (rowValues.length != header.size()) throw new IllegalStateException(\"short row: \" + Arrays.toString(rowValues));","typeGuard":null,"tryCatchPattern":"try { parseRow(cells, schema); } catch (IllegalArgumentException e) { /* send row to dead-letter, continue */ }","preventionTips":["Mark fields nullable when data files may legitimately omit them.","Filter or repair ragged rows (wrong column counts) before parsing.","Add a data-quality check step that reports short/empty rows and counts."],"tags":["java","beam-io","csv","null-value","data-quality"],"backgroundTag":"schema-validation-failed","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"}