{"record":{"id":"3cdb8387f682cdc6","repo":"apache/beam","slug":"options-say-to-use-higher-bit-type-but-that-is-impossible","errorCode":null,"errorMessage":"Options say to use higher bit type, but that is impossible for 64-bit integers.","messagePattern":"Options say to use higher bit type, but that is impossible for 64-bit integers\\.","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":131,"sourceCode":"        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  }\n\n  private static FieldType convertUint64(SbeFieldOptions options) {\n    Behavior behavior = options.unsignedOptions().uint64Behavior();\n    switch (behavior) {\n      case SAME_BIT_SIGNED:\n        return FieldType.INT64;\n      case HIGHER_BIT_SIGNED:\n        throw new IllegalStateException(\n            \"Options say to use higher bit type, but that is impossible for 64-bit integers.\");\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 uint64 behavior: \" + behavior.name());\n    }\n  }\n\n  public static Builder builder() {\n    return new AutoValue_PrimitiveSbeField.Builder();\n  }\n\n  /** Builder for {@link PrimitiveSbeField}. */\n  @AutoValue.Builder\n  public abstract static class Builder {\n","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sbe/src/main/java/org/apache/beam/sdk/extensions/sbe/PrimitiveSbeField.java#L113-L149","documentation":"This IllegalStateException is thrown by PrimitiveSbeField.convertUint64 when uint64Behavior is HIGHER_BIT_SIGNED. Widening a 64-bit unsigned integer to a higher-bit signed type is impossible (there is no 128-bit signed FieldType), so the extension rejects this configuration explicitly instead of overflowing values.","triggerScenarios":"Configuring SbeFieldOptions.unsignedOptions().uint64Behavior() = Behavior.HIGHER_BIT_SIGNED and translating a uint64 SBE field via beamType().","commonSituations":"Applying a uniform 'use higher bit signed' policy to all unsigned fields without special-casing 64-bit; copying uint8/16/32 option setup to uint64.","solutions":["Change uint64Behavior to SAME_BIT_SIGNED (map to int64), CONVERT_TO_STRING, or CONVERT_TO_BIG_DECIMAL.","Use CONVERT_TO_BIG_DECIMAL or CONVERT_TO_STRING when full uint64 range must be preserved.","Add a special case for uint64 when generating options programmatically.","Document/validate that HIGHER_BIT_SIGNED is only valid for uint8/16/32."],"exampleFix":"// before\noptions.setUint64Behavior(Behavior.HIGHER_BIT_SIGNED);\n// after\noptions.setUint64Behavior(Behavior.CONVERT_TO_BIG_DECIMAL);","handlingStrategy":"validation","validationCode":"if (options.unsignedOptions().uint64Behavior() == Behavior.HIGHER_BIT_SIGNED) {\n  throw new IllegalArgumentException(\"HIGHER_BIT_SIGNED invalid for uint64; use SAME_BIT_SIGNED, CONVERT_TO_STRING, or CONVERT_TO_BIG_DECIMAL\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  pipeline.apply(SbeIO.readMessages(...));\n} catch (IllegalStateException e) {\n  if (e.getMessage().contains(\"impossible for 64-bit integers\")) {\n    // switch uint64Behavior to SAME_BIT_SIGNED or CONVERT_TO_STRING/BIG_DECIMAL\n  }\n}","preventionTips":["Never apply HIGHER_BIT_SIGNED to uint64 fields.","Use CONVERT_TO_BIG_DECIMAL or CONVERT_TO_STRING to preserve full uint64 range.","Special-case 64-bit fields when generating options programmatically.","Validate behavior-per-primitive-type mapping before submission."],"tags":["java","sbe","invalid-configuration","integer-overflow"],"backgroundTag":"conflicting-config-options","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"}