apache/beam · error · IllegalStateException
Most (%s) and least (%s) significant bits value shouldn't be
Error message
Most (%s) and least (%s) significant bits value shouldn't be null for UUID
What it means
UuidLogicalType.toInputType converts a base Row representation (two int64 fields: most/least significant bits) back into a java.util.UUID. If either bit field is null in the Row, it throws this IllegalStateException since a UUID cannot be constructed from missing bits.
Source
Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/logicaltypes/UuidLogicalType.java:70
@Override
public FieldType getBaseType() {
return Schema.FieldType.row(UUID_SCHEMA);
}
@Override
public Row toBaseType(UUID input) {
return Row.withSchema(UUID_SCHEMA)
.addValues(input.getMostSignificantBits(), input.getLeastSignificantBits())
.build();
}
@Override
public UUID toInputType(Row base) {
Long leastSignificantBitsValue = base.getInt64(LEAST_SIGNIFICANT_BITS_FIELD_NAME);
Long mostSignificantBitsValue = base.getInt64(MOST_SIGNIFICANT_BITS_FIELD_NAME);
if (leastSignificantBitsValue == null || mostSignificantBitsValue == null) {
throw new IllegalStateException(
String.format(
"Most (%s) and least (%s) significant bits value shouldn't be null for UUID",
mostSignificantBitsValue, leastSignificantBitsValue));
}
return new UUID(mostSignificantBitsValue, leastSignificantBitsValue);
}
}
View on GitHub (pinned to 12126d8942)
Solutions
- Ensure both most/least significant bits fields are set when creating Rows with UUID fields
- Declare the field nullable in the schema and check for null before converting, or use a sentinel UUID
- Sanitize upstream data so null UUIDs are rejected at write time
- Catch IllegalStateException around toInputType/Row-to-POJO conversion and treat as null UUID
Example fix
// before Row r = Row.withSchema(uuidSchema).addValues(null, null).build(); // after UUID uuid = UUID.randomUUID(); Row r = Row.withSchema(uuidSchema).addValues(uuid.getMostSignificantBits(), uuid.getLeastSignificantBits()).build();
Defensive patterns
Strategy: validation
Validate before calling
Long msb = base.getInt64("mostSignificantBits");
Long lsb = base.getInt64("leastSignificantBits");
if (msb == null || lsb == null) { throw new IllegalArgumentException("UUID bits must not be null"); } Type guard
boolean hasUuidBits(org.apache.beam.sdk.values.Row r) { return r.getInt64("mostSignificantBits") != null && r.getInt64("leastSignificantBits") != null; } Try / catch
try { UUID u = (UUID) row.getValue("id"); } catch (IllegalStateException e) { UUID u = null; /* treat as missing UUID */ } Prevention
- Never create Rows with null UUID bit fields; use nullable schema fields and check before conversion
- Validate rows after decoding external data
- Use a sentinel UUID instead of nulls in legacy data
When it happens
Trigger: Reading a Row with a UUID logical-type field where either 'mostSignificantBits' or 'leastSignificantBits' is null — e.g. a Row built manually with missing fields, or data decoded from a source that wrote nulls.
Common situations: Rows created programmatically with only one of the two UUID fields set; nullable UUID fields read from external storage; pipeline data written by older schemas lacking the UUID fields.
Related errors
- Null value found for field that doesn't support nulls.
- FieldTypeValue has no value but the field cannot be null.
- Logical types don't match and cannot be merged: +identifier1
- Not an inferred logical type: ${rawType}
- Received null value for non-nullable field "{}"
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/bde6e9a6456fd843.
Report an issue: GitHub.