{"record":{"id":"bad19660b3801e2b","repo":"quarkusio/quarkus","slug":"unsigned-integers-support-only-up-to-63-bits","errorCode":null,"errorMessage":"Unsigned integers support only up to 63 bits","messagePattern":"Unsigned integers support only up to 63 bits","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/bitmap/BitFieldArgs.java","lineNumber":46,"sourceCode":"                this.bits = Integer.parseInt(bit.substring(1));\n            } else if (bit.startsWith(\"u\")) {\n                this.signed = false;\n                this.bits = Integer.parseInt(bit.substring(1));\n            }\n            throw new IllegalArgumentException(\"Invalid integer encoding for a bit field type: \" + bit +\n                    \". It must start with `i` (signed integers) or `u` (unsigned integers)\");\n        }\n\n        public BitFieldType(boolean signed, int bits) {\n            if (bits <= 0) {\n                throw new IllegalArgumentException(\"`bits` must be strictly positive\");\n            }\n\n            if (signed && bits >= 65) {\n                throw new IllegalArgumentException(\"Signed integers support only up to 64 bits\");\n            }\n            if (!signed && bits >= 64) {\n                throw new IllegalArgumentException(\"Unsigned integers support only up to 63 bits\");\n            }\n\n            this.signed = signed;\n            this.bits = bits;\n        }\n\n        @Override\n        public String toString() {\n            return (signed ? \"i\" : \"u\") + bits;\n        }\n\n    }\n\n    /**\n     * Represents a bit field offset.\n     * See also <a href=\"https://redis.io/commands/bitfield#bits-and-positional-offsets\">Bits and positional offsets</a>\n     */\n    public static class Offset {","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/bitmap/BitFieldArgs.java#L28-L64","documentation":"An unsigned Redis bit-field integer is limited to 63 bits because the library holds values in a signed Java long; 64 unsigned bits could overflow into the sign bit. Widths >= 64 are rejected with IllegalArgumentException.","triggerScenarios":"new BitFieldArgs.BitFieldType(false, 64) or higher; parsing \"u64\" or \"u128\"; using the same width constant for signed and unsigned variants.","commonSituations":"Assuming u64 is valid since i64 is; porting code that used 64-bit unsigned masks; modeling 128-bit unsigned values.","solutions":["Use at most 63 bits for unsigned types","Use BitFieldArgs.BitFieldType.unsignedIn63() for the widest unsigned type","Use a signed 64-bit field if the value fits in long range"],"exampleFix":"// before\nnew BitFieldArgs.BitFieldType(false, 64);\n// after\nnew BitFieldArgs.BitFieldType(false, 63);","handlingStrategy":"validation","validationCode":"if (!signed && bits >= 64) { throw new IllegalArgumentException(\"unsigned width must be <= 63\"); }","typeGuard":"static boolean isValidUnsignedWidth(int bits) { return bits >= 1 && bits <= 63; }","tryCatchPattern":"try { type = new BitFieldArgs.BitFieldType(false, bits); } catch (IllegalArgumentException e) { type = BitFieldArgs.BitFieldType.unsignedIn63(); }","preventionTips":["Cap unsigned widths at 63","Remember values are held in a signed long","Use unsignedIn63() for the widest unsigned field"],"tags":["redis","bitfield","argument-validation"],"backgroundTag":"invalid-argument-format","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}