quarkusio/quarkus · error · IllegalArgumentException

Signed integers support only up to 64 bits

Error message

Signed integers support only up to 64 bits

What it means

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.

Source

Thrown at extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/bitmap/BitFieldArgs.java:43

        public BitFieldType(String bit) {
            if (bit.startsWith("i")) {
                this.signed = true;
                this.bits = Integer.parseInt(bit.substring(1));
            } else if (bit.startsWith("u")) {
                this.signed = false;
                this.bits = Integer.parseInt(bit.substring(1));
            }
            throw new IllegalArgumentException("Invalid integer encoding for a bit field type: " + bit +
                    ". It must start with `i` (signed integers) or `u` (unsigned integers)");
        }

        public BitFieldType(boolean signed, int bits) {
            if (bits <= 0) {
                throw new IllegalArgumentException("`bits` must be strictly positive");
            }

            if (signed && bits >= 65) {
                throw new IllegalArgumentException("Signed integers support only up to 64 bits");
            }
            if (!signed && bits >= 64) {
                throw new IllegalArgumentException("Unsigned integers support only up to 63 bits");
            }

            this.signed = signed;
            this.bits = bits;
        }

        @Override
        public String toString() {
            return (signed ? "i" : "u") + bits;
        }

    }

    /**
     * Represents a bit field offset.

View on GitHub (pinned to e1c734241f)

Solutions

  1. Use at most 64 bits for signed types
  2. Use BitFieldArgs.BitFieldType.signIn64() for the widest signed type
  3. Switch to two fields or store as string if a 128-bit value is truly needed

Example fix

// before
new BitFieldArgs.BitFieldType(true, 128);
// after
new BitFieldArgs.BitFieldType(true, 64);
Defensive patterns

Strategy: validation

Validate before calling

if (signed && bits >= 65) { throw new IllegalArgumentException("signed width must be <= 64"); }

Type guard

static boolean isValidSignedWidth(int bits) { return bits >= 1 && bits <= 64; }

Try / catch

try { type = new BitFieldArgs.BitFieldType(true, bits); } catch (IllegalArgumentException e) { type = BitFieldArgs.BitFieldType.signIn64(); }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/160c1d3b293d6078. Report an issue: GitHub.