{"record":{"id":"c756a7d38159bd27","repo":"apache/beam","slug":"unrecognized-uint16-behavior-behavior-name","errorCode":null,"errorMessage":"Unrecognized uint16 behavior: ${behavior.name()}","messagePattern":"Unrecognized uint16 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":105,"sourceCode":"        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  }\n\n  private static FieldType convertUint32(SbeFieldOptions options) {\n    Behavior behavior = options.unsignedOptions().uint32Behavior();\n    switch (behavior) {\n      case SAME_BIT_SIGNED:\n        return FieldType.INT32;\n      case HIGHER_BIT_SIGNED:\n        return FieldType.INT64;\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 uint32 behavior: \" + behavior.name());\n    }\n  }","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sbe/src/main/java/org/apache/beam/sdk/extensions/sbe/PrimitiveSbeField.java#L87-L123","documentation":"This IllegalStateException is thrown by PrimitiveSbeField.convertUint16 when the configured uint16Behavior is not one of the Behavior values handled in the switch. It is an exhaustiveness/default-branch guard preventing an unknown unsigned-16-bit behavior from silently producing a wrong Beam FieldType.","triggerScenarios":"Translating a uint16 SBE field whose SbeFieldOptions.unsignedOptions().uint16Behavior() holds a Behavior value absent from the switch (not SAME_BIT_SIGNED, HIGHER_BIT_SIGNED, CONVERT_TO_STRING, CONVERT_TO_BIG_DECIMAL).","commonSituations":"Mismatched versions where a new Behavior constant was added to the enum but not this switch; corrupted or hand-built options objects.","solutions":["Set uint16Behavior to a supported Behavior value.","Upgrade or downgrade so the SbeFieldOptions Behavior enum and the switch logic come from the same Beam version.","Check and fix the SBE pipeline options defining uint16 behavior.","Add pre-translation validation of behavior values."],"exampleFix":"// before\noptions.setUint16Behavior(Behavior.HIGHER_BIT_SIGNED_UNHANDLED);\n// after\noptions.setUint16Behavior(Behavior.HIGHER_BIT_SIGNED);","handlingStrategy":"validation","validationCode":"Behavior b = options.unsignedOptions().uint16Behavior();\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 uint16Behavior: \" + b);\n}","typeGuard":null,"tryCatchPattern":"try {\n  pipeline.apply(SbeIO.readMessages(...));\n} catch (IllegalStateException e) {\n  if (e.getMessage().startsWith(\"Unrecognized uint16 behavior\")) {\n    // fix uint16Behavior in options and rebuild\n  }\n}","preventionTips":["Use only supported Behavior values for uint16Behavior.","Version-align SbeFieldOptions usage with the Beam SBE extension.","Validate options before pipeline submission.","Avoid cross-version serialization of behavior settings."],"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"}