{"record":{"id":"666c762ecfa5d66e","repo":"quarkusio/quarkus","slug":"offset-must-not-be-null","errorCode":null,"errorMessage":"`offset` must not be `null`","messagePattern":"`offset` must not be `null`","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/bitmap/BitFieldArgs.java","lineNumber":145,"sourceCode":"     *\n     * @param bft the bit field type, must not be {@code null}.\n     * @param offset bitfield offset\n     * @return the current {@code BitFieldArgs}\n     */\n    public BitFieldArgs get(BitFieldType bft, int offset) {\n        return get(bft, new Offset(false, offset));\n    }\n\n    /**\n     * Adds a new {@code GET} subcommand.\n     *\n     * @param bft the bit field type, must not be {@code null}.\n     * @param offset bitfield offset\n     * @return the current {@code BitFieldArgs}\n     */\n    public BitFieldArgs get(BitFieldType bft, Offset offset) {\n        if (offset == null) {\n            throw new IllegalArgumentException(\"`offset` must not be `null`\");\n        }\n        if (offset.offset < 0) {\n            throw new IllegalArgumentException(\"`offset` must be greater or equal to 0\");\n        }\n\n        this.previousBitFieldType = bft;\n        this.commands.addAll(List.of(\"GET\", bft.toString(), offset.toString()));\n        return this;\n    }\n\n    /**\n     * Adds a new {@code SET} subcommand.\n     *\n     * @param bft the bit field type, must not be {@code null}.\n     * @param offset bitfield offset\n     * @param value the value\n     * @return the current {@code BitFieldArgs}\n     */","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/bitmap/BitFieldArgs.java#L127-L163","documentation":"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.","triggerScenarios":"Calling args.get(bft, null), typically when the Offset was computed conditionally and ended up null, or a helper method forwarding an unset offset.","commonSituations":"Offset derived from an optional config value; null returned from a lookup; method refactoring where the offset parameter became optional.","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()"],"exampleFix":"// before\nBitFieldArgs.Offset offset = computeOffset(); // may be null\nargs.get(BitFieldArgs.BitFieldType.unsignedIn8(), offset);\n// after\nBitFieldArgs.Offset offset = computeOffset();\nif (offset != null) {\n    args.get(BitFieldArgs.BitFieldType.unsignedIn8(), offset);\n}","handlingStrategy":"type-guard","validationCode":"Objects.requireNonNull(offset, \"offset required\");\nargs.get(bft, offset);","typeGuard":"static boolean hasValidOffset(BitFieldArgs.Offset o) { return o != null; }","tryCatchPattern":"try { args.get(bft, offset); } catch (IllegalArgumentException e) { log.warn(\"Skipping BITFIELD GET: \" + e.getMessage()); }","preventionTips":["Construct Offset eagerly, never leave it null","Check offset-producing helpers for null returns","Skip the GET sub-command when no offset exists"],"tags":["redis","bitfield","null-check"],"backgroundTag":"null-argument-validation","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}