{"record":{"id":"a17010593ec56ef3","repo":"apache/beam","slug":"unexpected-null-number-for-field","errorCode":null,"errorMessage":"Unexpected null number for <field>","messagePattern":"Unexpected null number for <field>","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/AutoValueSchema.java","lineNumber":78,"sourceCode":"              .filter(m -> !Modifier.isProtected(m.getModifiers()))\n              .filter(m -> !m.isAnnotationPresent(SchemaIgnore.class))\n              .collect(Collectors.toList());\n      List<FieldValueTypeInformation> types = Lists.newArrayListWithCapacity(methods.size());\n      for (int i = 0; i < methods.size(); ++i) {\n        types.add(FieldValueTypeInformation.forGetter(typeDescriptor, methods.get(i), i));\n      }\n      types.sort(JavaBeanUtils.comparingNullFirst(FieldValueTypeInformation::getNumber));\n      validateFieldNumbers(types);\n      return types;\n    }\n  }\n\n  private static void validateFieldNumbers(List<FieldValueTypeInformation> types) {\n    for (int i = 0; i < types.size(); ++i) {\n      FieldValueTypeInformation type = types.get(i);\n      @javax.annotation.Nullable Integer number = type.getNumber();\n      if (number == null) {\n        throw new RuntimeException(\"Unexpected null number for \" + type.getName());\n      }\n      Preconditions.checkState(\n          number == i,\n          \"Expected field number %s for field %s instead got %s\",\n          i,\n          type.getName(),\n          number);\n    }\n  }\n\n  @Override\n  public <T> List<FieldValueGetter<@NonNull T, Object>> fieldValueGetters(\n      TypeDescriptor<T> targetTypeDescriptor, Schema schema) {\n    return JavaBeanUtils.getGetters(\n        targetTypeDescriptor,\n        schema,\n        AbstractGetterTypeSupplier.INSTANCE,\n        new DefaultTypeConversionsFactory());","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/AutoValueSchema.java#L60-L96","documentation":"AutoValueSchema requires every AutoValue property used as a schema field to carry a @Nullable-annotated field number ordering check; here it found a FieldValueTypeInformation whose number is null. This means Beam could not determine the declared field index (from an annotation or generated metadata) for that AutoValue property.","triggerScenarios":"Calling Schema.of / schema inference on an AutoValue class (AutoValueSchema.schemaType / validateFieldNumbers) where a property lacks the expected field-number metadata (e.g. missing @AutoValue field ordering info or a schema annotation providing numbers).","commonSituations":"Mixing AutoValue classes annotated for Beam schema with plain getters; using an older/newer AutoValue generated class whose metadata Beam cannot read; manually built FieldValueTypeInformation lists in tests or custom type suppliers missing numbers.","solutions":["Regenerate the AutoValue class (clean build) so generated metadata is present and consistent.","Ensure the AutoValue class is annotated for schema use (e.g. @DefaultSchema(AutoValueSchema.class)) and properties are plain abstract getters.","If supplying FieldValueTypeInformation manually, set field numbers explicitly.","Check for conflicting schema annotation processors or stale generated classes in the build."],"exampleFix":"// before\n@AutoValue public abstract class Foo { public abstract Object getA(); }\n\n// after: rebuild and use supported property types\n@AutoValue @DefaultSchema(AutoValueSchema.class)\npublic abstract class Foo { public abstract String getA(); }","handlingStrategy":"validation","validationCode":"for (FieldValueTypeInformation f : types) { if (f.getNumber() == null) throw new IllegalStateException(\"missing number: \" + f.getName()); }","typeGuard":null,"tryCatchPattern":"try { Schema.of(AutoValueClass.class); }\ncatch (RuntimeException e) { if (e.getMessage().startsWith(\"Unexpected null number\")) { /* rebuild annotations / regenerate */ } throw e; }","preventionTips":["Clean-build regularly to keep AutoValue-generated metadata fresh","Use plain abstract getters on @AutoValue classes","Keep the beam-schemas and AutoValue processor versions aligned"],"tags":["autovalue","schema","beam-schemas"],"backgroundTag":"internal-invariant-violation","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"}