{"record":{"id":"20303d9c366fde34","repo":"apache/beam","slug":"unrecognized-uint8-behavior-behavior-name","errorCode":null,"errorMessage":"Unrecognized uint8 behavior: ${behavior.name()}","messagePattern":"Unrecognized uint8 behavior: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sbe/src/main/java/org/apache/beam/sdk/extensions/sbe/PrimitiveSbeField.java","lineNumber":89,"sourceCode":"      default:\n        throw new IllegalStateException(\n            \"Got a state that is not recognized: \" + type().primitiveName());\n    }\n  }\n\n  private static FieldType convertUint8(SbeFieldOptions options) {\n    Behavior behavior = options.unsignedOptions().uint8Behavior();\n    switch (behavior) {\n      case SAME_BIT_SIGNED:\n        return FieldType.BYTE;\n      case HIGHER_BIT_SIGNED:\n        return FieldType.INT16;\n      case CONVERT_TO_STRING:\n        return FieldType.STRING;\n      case CONVERT_TO_BIG_DECIMAL:\n        return FieldType.DECIMAL;\n      default:\n        throw new IllegalStateException(\"Unrecognized uint8 behavior: \" + behavior.name());\n    }\n  }\n\n  private static FieldType convertUint16(SbeFieldOptions options) {\n    Behavior behavior = options.unsignedOptions().uint16Behavior();\n    switch (behavior) {\n      case SAME_BIT_SIGNED:\n        return FieldType.INT16;\n      case HIGHER_BIT_SIGNED:\n        return FieldType.INT32;\n      case CONVERT_TO_STRING:\n        return FieldType.STRING;\n      case CONVERT_TO_BIG_DECIMAL:\n        return FieldType.DECIMAL;\n      default:\n        throw new IllegalStateException(\"Unrecognized uint16 behavior: \" + behavior.name());\n    }\n  }","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sbe/src/main/java/org/apache/beam/sdk/extensions/sbe/PrimitiveSbeField.java#L71-L107","documentation":"This IllegalStateException is thrown by PrimitiveSbeField.convertUint8 when the configured uint8Behavior does not match any known Behavior enum value in the switch. It is an internal exhaustiveness guard: the Behavior configured via SbeFieldOptions was not one of SAME_BIT_SIGNED, HIGHER_BIT_SIGNED, CONVERT_TO_STRING, or CONVERT_TO_BIG_DECIMAL as handled here.","triggerScenarios":"Configuring SbeFieldOptions.unsignedOptions().uint8Behavior() with a Behavior value the switch does not handle, then translating a uint8 SBE field's Beam type.","commonSituations":"Version mismatch between the code building SbeFieldOptions (knows a new Behavior value) and this switch (written before it); programmatic construction of options with null or exotic values.","solutions":["Set uint8Behavior to one of the supported values: SAME_BIT_SIGNED, HIGHER_BIT_SIGNED, CONVERT_TO_STRING, CONVERT_TO_BIG_DECIMAL.","Align the Beam/SBE extension versions so SbeFieldOptions and PrimitiveSbeField agree on the Behavior enum.","Inspect the SBE pipeline options for the uint8 behavior setting and correct it.","Validate the configured behavior before building the transform."],"exampleFix":"// before\noptions.setUint8Behavior(unrecognizedBehavior);\n// after\noptions.setUint8Behavior(Behavior.CONVERT_TO_STRING);","handlingStrategy":"validation","validationCode":"Behavior b = options.unsignedOptions().uint8Behavior();\nif (b != Behavior.SAME_BIT_SIGNED && b != Behavior.HIGHER_BIT_SIGNED\n    && b != Behavior.CONVERT_TO_STRING && b != Behavior.CONVERT_TO_BIG_DECIMAL) {\n  throw new IllegalArgumentException(\"unsupported uint8Behavior: \" + b);\n}","typeGuard":null,"tryCatchPattern":"try {\n  pipeline.apply(SbeIO.readMessages(...));\n} catch (IllegalStateException e) {\n  if (e.getMessage().startsWith(\"Unrecognized uint8 behavior\")) {\n    // correct options and retry pipeline construction\n  }\n}","preventionTips":["Set uint8Behavior only to documented Behavior values.","Keep options-building code and Beam version in sync.","Validate behavior enums right after building SbeFieldOptions.","Avoid persisting raw enum ordinals/values across versions."],"tags":["java","sbe","unhandled-switch-case","configuration"],"backgroundTag":"unsupported-enum-value","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"}