apache/beam · error · IllegalStateException
Got a state that is not recognized
Error message
Got a state that is not recognized: ${type().primitiveName()} What it means
This IllegalStateException is thrown by PrimitiveSbeField.beamType when the SBE field's PrimitiveType does not match any case in the mapping switch and hits the default branch. It indicates the extension encountered a primitive type it does not recognize or that was added later, i.e. an unhandled state in the type-translation logic.
Solutions
- Use a supported SBE primitive type (int8/16/32/64, uint8/16/32/64) in the schema.
- Upgrade the Beam SBE extension / Beam version to one that recognizes the type.
- If custom types are in play, preprocess the schema to map them onto supported primitives.
- File/consult https://github.com/apache/beam to have the type handled explicitly.
Example fix
// before <type name="MyType" primitiveType="someUnsupported"/> // after <type name="MyType" primitiveType="int64"/>
Defensive patterns
Strategy: try-catch
Validate before calling
Set<String> supported = Set.of("INT8","INT16","INT32","INT64","UINT8","UINT16","UINT32","UINT64");
// check each field's primitiveType against 'supported' before running Try / catch
try {
pipeline.apply(SbeIO.readMessages(...));
} catch (IllegalStateException e) {
if (e.getMessage().startsWith("Got a state that is not recognized")) {
// report unsupported primitive type and abort or use fallback schema
}
} Prevention
- Use only SBE primitive types supported by the extension.
- Keep Beam and the SBE extension upgraded together.
- Pre-validate schema primitive types before submission.
- Report unsupported primitives upstream to the Beam project.
When it happens
Trigger: Translating an SBE schema field whose primitive type (e.g. a newly added SBE PrimitiveType not covered by the switch) falls through to the default case in beamType().
Common situations: Schemas using SBE primitive types beyond the covered set (CHAR handled separately, int8/16/32/64, uint8/16/32/64); newer SBE library versions introducing types the Beam extension predates.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Unrecognized uint16 behavior
- Unrecognized uint32 behavior
- Unrecognized uint64 behavior
- Unrecognized uint8 behavior
- char type not supported yet…
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/ed02fc321e4ffdc8.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/extensions/sbe/src/main/java/org/apache/beam/sdk/extensions/sbe/PrimitiveSbeField.java:72
return FieldType.INT16;
case INT32:
return FieldType.INT32;
case INT64:
return FieldType.INT64;
case FLOAT:
return FieldType.FLOAT;
case DOUBLE:
return FieldType.DOUBLE;
case UINT8:
return convertUint8(options);
case UINT16:
return convertUint16(options);
case UINT32:
return convertUint32(options);
case UINT64:
return convertUint64(options);
default:
throw new IllegalStateException(
"Got a state that is not recognized: " + type().primitiveName());
}
}
private static FieldType convertUint8(SbeFieldOptions options) {
Behavior behavior = options.unsignedOptions().uint8Behavior();
switch (behavior) {
case SAME_BIT_SIGNED:
return FieldType.BYTE;
case HIGHER_BIT_SIGNED:
return FieldType.INT16;
case CONVERT_TO_STRING:
return FieldType.STRING;
case CONVERT_TO_BIG_DECIMAL:
return FieldType.DECIMAL;
default:
throw new IllegalStateException("Unrecognized uint8 behavior: " + behavior.name());
}View on GitHub (pinned to 12126d8942)