{"record":{"id":"4ff129f3bb87805d","repo":"apache/beam","slug":"expected-the-partition-to-be-not-null","errorCode":null,"errorMessage":"Expected the partition to be not null","messagePattern":"Expected the partition to be not null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/kafka/upgrade/src/main/java/org/apache/beam/sdk/io/kafka/upgrade/KafkaIOTranslation.java","lineNumber":287,"sourceCode":"          transform = transform.withConsumerConfigUpdates(updatedConsumerConfig);\n        }\n        Collection<String> topics = configRow.getArray(\"topics\");\n        if (topics != null) {\n          transform = transform.withTopics(new ArrayList<>(topics));\n        }\n        Collection<Row> topicPartitionRows = configRow.getArray(\"topic_partitions\");\n        if (topicPartitionRows != null && !topicPartitionRows.isEmpty()) {\n          Collection<TopicPartition> topicPartitions =\n              topicPartitionRows.stream()\n                  .map(\n                      row -> {\n                        String topic = row.getString(\"topic\");\n                        if (topic == null) {\n                          throw new IllegalArgumentException(\"Expected the topic to be not null\");\n                        }\n                        Integer partition = row.getInt32(\"partition\");\n                        if (partition == null) {\n                          throw new IllegalArgumentException(\n                              \"Expected the partition to be not null\");\n                        }\n                        return new TopicPartition(topic, partition);\n                      })\n                  .collect(Collectors.toList());\n          transform = transform.withTopicPartitions(Lists.newArrayList(topicPartitions));\n        }\n        String topicPattern = configRow.getString(\"topic_pattern\");\n        if (topicPattern != null) {\n          transform = transform.withTopicPattern(topicPattern);\n        }\n\n        byte[] keyDeserializerProvider = configRow.getBytes(\"key_deserializer_provider\");\n        if (keyDeserializerProvider != null) {\n\n          byte[] keyCoder = configRow.getBytes(\"key_coder\");\n          if (keyCoder != null) {\n            transform =","sourceCodeStart":269,"sourceCodeEnd":305,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/kafka/upgrade/src/main/java/org/apache/beam/sdk/io/kafka/upgrade/KafkaIOTranslation.java#L269-L305","documentation":"Same reconstruction path as the topic check: each topic_partition Row must have a non-null \"partition\" int32. A null partition makes it impossible to build a TopicPartition, so IllegalArgumentException is thrown.","triggerScenarios":"Restoring a KafkaIO read transform whose config Row's topic_partition Rows have a null \"partition\" field.","commonSituations":"Manually built or tool-generated config Rows missing the partition field; schema drift where partition was dropped during serialization.","solutions":["Set the \"partition\" int32 field on every topic_partition Row.","Regenerate the config Row from the source transform with row()/toConfigRow.","Validate all topic partition Rows before upgrade submission."],"exampleFix":"// before\nrow.getString(\"partition\"); // null, wrong field\n// after\nrow.getInt32(\"partition\"); // ensure int32 partition is populated\n","handlingStrategy":"validation","validationCode":"for (Row r : configRow.getArray(\"topic_partition\")) {\n  if (r.getInt32(\"partition\") == null) throw new IllegalArgumentException(\"topic_partition Row missing partition\");\n}","typeGuard":"boolean hasPartition(Row r) { return r != null && r.getInt32(\"partition\") != null; }","tryCatchPattern":"try {\n  transform = fromConfigRow(configRow);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"partition to be not null\")) { /* repair or regenerate the payload */ }\n  throw e;\n}","preventionTips":["Set partition as int32 in every topic_partition Row.","Prefer round-tripping through toConfigRow/row() over manual payload construction.","Validate payload Rows before upgrade submission."],"tags":["kafka","deserialization","null-value","topic-partition"],"backgroundTag":"missing-required-argument","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}