{"record":{"id":"160c1d3b293d6078","repo":"quarkusio/quarkus","slug":"signed-integers-support-only-up-to-64-bits","errorCode":null,"errorMessage":"Signed integers support only up to 64 bits","messagePattern":"Signed integers support only up to 64 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":43,"sourceCode":"        public BitFieldType(String bit) {\n            if (bit.startsWith(\"i\")) {\n                this.signed = true;\n                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.","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/bitmap/BitFieldArgs.java#L25-L61","documentation":"A signed Redis bit-field integer is limited to 64 bits (it must fit in a Java long). The BitFieldType constructor rejects any signed width >= 65 with IllegalArgumentException because Redis cannot represent wider signed integers.","triggerScenarios":"new BitFieldArgs.BitFieldType(true, 65) or higher; also parsing \"i65\"/\"i128\", e.g. from config or an attempt to model a 128-bit signed integer.","commonSituations":"Trying to store 128-bit values (Redis BITFIELD doesn't support them); confusing signed max of 64 with unsigned max of 63; copying an unsigned width parameter into a signed constructor.","solutions":["Use at most 64 bits for signed types","Use BitFieldArgs.BitFieldType.signIn64() for the widest signed type","Switch to two fields or store as string if a 128-bit value is truly needed"],"exampleFix":"// before\nnew BitFieldArgs.BitFieldType(true, 128);\n// after\nnew BitFieldArgs.BitFieldType(true, 64);","handlingStrategy":"validation","validationCode":"if (signed && bits >= 65) { throw new IllegalArgumentException(\"signed width must be <= 64\"); }","typeGuard":"static boolean isValidSignedWidth(int bits) { return bits >= 1 && bits <= 64; }","tryCatchPattern":"try { type = new BitFieldArgs.BitFieldType(true, bits); } catch (IllegalArgumentException e) { type = BitFieldArgs.BitFieldType.signIn64(); }","preventionTips":["Cap signed widths at 64","Use signIn64() for the widest signed field","Never share one width constant between signed and unsigned types"],"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"}