quarkusio/quarkus · error · IllegalArgumentException
`offset` must not be `null`
Error message
`offset` must not be `null`
What it means
BitFieldArgs.get() records a BITFIELD GET sub-command. The Offset parameter is validated eagerly and a null offset is rejected with IllegalArgumentException, since Redis requires an explicit bit offset for GET.
Source
Thrown at extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/bitmap/BitFieldArgs.java:145
*
* @param bft the bit field type, must not be {@code null}.
* @param offset bitfield offset
* @return the current {@code BitFieldArgs}
*/
public BitFieldArgs get(BitFieldType bft, int offset) {
return get(bft, new Offset(false, offset));
}
/**
* Adds a new {@code GET} subcommand.
*
* @param bft the bit field type, must not be {@code null}.
* @param offset bitfield offset
* @return the current {@code BitFieldArgs}
*/
public BitFieldArgs get(BitFieldType bft, Offset offset) {
if (offset == null) {
throw new IllegalArgumentException("`offset` must not be `null`");
}
if (offset.offset < 0) {
throw new IllegalArgumentException("`offset` must be greater or equal to 0");
}
this.previousBitFieldType = bft;
this.commands.addAll(List.of("GET", bft.toString(), offset.toString()));
return this;
}
/**
* Adds a new {@code SET} subcommand.
*
* @param bft the bit field type, must not be {@code null}.
* @param offset bitfield offset
* @param value the value
* @return the current {@code BitFieldArgs}
*/View on GitHub (pinned to e1c734241f)
Solutions
- Construct a valid Offset, e.g. new BitFieldArgs.Offset(0)
- Guard the call and skip the GET sub-command if no offset is available
- Validate the offset before calling get()
Example fix
// before
BitFieldArgs.Offset offset = computeOffset(); // may be null
args.get(BitFieldArgs.BitFieldType.unsignedIn8(), offset);
// after
BitFieldArgs.Offset offset = computeOffset();
if (offset != null) {
args.get(BitFieldArgs.BitFieldType.unsignedIn8(), offset);
} Defensive patterns
Strategy: type-guard
Validate before calling
Objects.requireNonNull(offset, "offset required"); args.get(bft, offset);
Type guard
static boolean hasValidOffset(BitFieldArgs.Offset o) { return o != null; } Try / catch
try { args.get(bft, offset); } catch (IllegalArgumentException e) { log.warn("Skipping BITFIELD GET: " + e.getMessage()); } Prevention
- Construct Offset eagerly, never leave it null
- Check offset-producing helpers for null returns
- Skip the GET sub-command when no offset exists
When it happens
Trigger: Calling args.get(bft, null), typically when the Offset was computed conditionally and ended up null, or a helper method forwarding an unset offset.
Common situations: Offset derived from an optional config value; null returned from a lookup; method refactoring where the offset parameter became optional.
Related errors
- The BitFieldType must not be `null`
- `btf` must not be `null`
- `pattern` must not be `null`
- Invalid integer encoding for a bit field type: " + bit + ".
- `bits` must be strictly positive
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/666c762ecfa5d66e.
Report an issue: GitHub.