{"record":{"id":"fe9d6b7dfbe1cb49","repo":"apache/beam","slug":"encountered-unspecified-atomictype","errorCode":null,"errorMessage":"Encountered UNSPECIFIED AtomicType","messagePattern":"Encountered UNSPECIFIED AtomicType","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/SchemaTranslation.java","lineNumber":378,"sourceCode":"            return FieldType.of(TypeName.BYTE);\n          case INT16:\n            return FieldType.of(TypeName.INT16);\n          case INT32:\n            return FieldType.of(TypeName.INT32);\n          case INT64:\n            return FieldType.of(TypeName.INT64);\n          case FLOAT:\n            return FieldType.of(TypeName.FLOAT);\n          case DOUBLE:\n            return FieldType.of(TypeName.DOUBLE);\n          case STRING:\n            return FieldType.of(TypeName.STRING);\n          case BOOLEAN:\n            return FieldType.of(TypeName.BOOLEAN);\n          case BYTES:\n            return FieldType.of(TypeName.BYTES);\n          case UNSPECIFIED:\n            throw new IllegalArgumentException(\"Encountered UNSPECIFIED AtomicType\");\n          default:\n            throw new IllegalArgumentException(\n                \"Encountered unknown AtomicType: \" + protoFieldType.getAtomicType());\n        }\n      case ROW_TYPE:\n        return FieldType.row(schemaFromProto(protoFieldType.getRowType().getSchema()));\n      case ARRAY_TYPE:\n        return FieldType.array(fieldTypeFromProto(protoFieldType.getArrayType().getElementType()));\n      case ITERABLE_TYPE:\n        return FieldType.iterable(\n            fieldTypeFromProto(protoFieldType.getIterableType().getElementType()));\n      case MAP_TYPE:\n        return FieldType.map(\n            fieldTypeFromProto(protoFieldType.getMapType().getKeyType()),\n            fieldTypeFromProto(protoFieldType.getMapType().getValueType()));\n      case LOGICAL_TYPE:\n        SchemaApi.LogicalType logicalType = protoFieldType.getLogicalType();\n        String urn = logicalType.getUrn();","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/SchemaTranslation.java#L360-L396","documentation":"fieldTypeFromProtoWithoutNullable switches on the proto FieldType's type and, upon AtomicType UNSPECIFIED, throws IllegalArgumentException. UNSPECIFIED means the producer did not set an atomic type at all, so the field type cannot be reconstructed.","triggerScenarios":"Decoding a FieldType proto whose atomic_type field was never set (UNSPECIFIED) — typically a proto written by buggy or foreign code, or a proto truncated/mis-serialized.","commonSituations":"Manually building SchemaApi protos without setting atomic_type; data produced by another system's schema exporter; corrupted messages crossing service boundaries.","solutions":["Fix the producer to set a concrete AtomicType (e.g. STRING, INT64, BOOLEAN, BYTES) for every atomic field.","Validate the proto before decoding: check protoFieldType.getAtomicType() != UNSPECIFIED.","If the data is legacy, re-encode the schema with a correct Beam SDK version.","Catch the IllegalArgumentException at schema decode and reject the record."],"exampleFix":"// before (producer)\nFieldType.Builder b = FieldType.newBuilder(); // atomic_type never set\n// after\nFieldType.Builder b = FieldType.newBuilder().setAtomicType(AtomicType.STRING);","handlingStrategy":"validation","validationCode":"if (protoFieldType.getTypeCase() == FieldType.TypeCase.ATOMIC_TYPE\n    && protoFieldType.getAtomicType() == AtomicType.UNSPECIFIED) {\n  throw new IllegalArgumentException(\"Field has UNSPECIFIED atomic type\");\n}","typeGuard":"boolean hasAtomicType(SchemaApi.FieldType ft) {\n  return ft.getTypeCase() == SchemaApi.FieldType.TypeCase.ATOMIC_TYPE\n      && ft.getAtomicType() != SchemaApi.AtomicType.UNSPECIFIED;\n}","tryCatchPattern":null,"preventionTips":["Always set atomic_type explicitly when building field protos.","Validate producer output against Beam's SchemaApi definitions.","Reject UNSPECIFIED at ingestion before deep decoding.","Keep proto definitions in sync with the SDK version."],"tags":["java","apache-beam","protobuf","schema"],"backgroundTag":"invalid-enum-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}