{"record":{"id":"bde6e9a6456fd843","repo":"apache/beam","slug":"most-s-and-least-s-significant-bits-value-shouldn-t-be-null","errorCode":null,"errorMessage":"Most (%s) and least (%s) significant bits value shouldn't be null for UUID","messagePattern":"Most \\((.+?)\\) and least \\((.+?)\\) significant bits value shouldn't be null for UUID","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/logicaltypes/UuidLogicalType.java","lineNumber":70,"sourceCode":"\n  @Override\n  public FieldType getBaseType() {\n    return Schema.FieldType.row(UUID_SCHEMA);\n  }\n\n  @Override\n  public Row toBaseType(UUID input) {\n    return Row.withSchema(UUID_SCHEMA)\n        .addValues(input.getMostSignificantBits(), input.getLeastSignificantBits())\n        .build();\n  }\n\n  @Override\n  public UUID toInputType(Row base) {\n    Long leastSignificantBitsValue = base.getInt64(LEAST_SIGNIFICANT_BITS_FIELD_NAME);\n    Long mostSignificantBitsValue = base.getInt64(MOST_SIGNIFICANT_BITS_FIELD_NAME);\n    if (leastSignificantBitsValue == null || mostSignificantBitsValue == null) {\n      throw new IllegalStateException(\n          String.format(\n              \"Most (%s) and least (%s) significant bits value shouldn't be null for UUID\",\n              mostSignificantBitsValue, leastSignificantBitsValue));\n    }\n    return new UUID(mostSignificantBitsValue, leastSignificantBitsValue);\n  }\n}\n","sourceCodeStart":52,"sourceCodeEnd":78,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/logicaltypes/UuidLogicalType.java#L52-L78","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nRow r = Row.withSchema(uuidSchema).addValues(null, null).build();\n// after\nUUID uuid = UUID.randomUUID();\nRow r = Row.withSchema(uuidSchema).addValues(uuid.getMostSignificantBits(), uuid.getLeastSignificantBits()).build();","handlingStrategy":"validation","validationCode":"Long msb = base.getInt64(\"mostSignificantBits\");\nLong lsb = base.getInt64(\"leastSignificantBits\");\nif (msb == null || lsb == null) { throw new IllegalArgumentException(\"UUID bits must not be null\"); }","typeGuard":"boolean hasUuidBits(org.apache.beam.sdk.values.Row r) { return r.getInt64(\"mostSignificantBits\") != null && r.getInt64(\"leastSignificantBits\") != null; }","tryCatchPattern":"try { UUID u = (UUID) row.getValue(\"id\"); } catch (IllegalStateException e) { UUID u = null; /* treat as missing UUID */ }","preventionTips":["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"],"tags":["java","schema","logical-type","null"],"backgroundTag":"null-argument","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"}