{"record":{"id":"dcecc2af4d81a69e","repo":"quarkusio/quarkus","slug":"btf-must-not-be-null","errorCode":null,"errorMessage":"`btf` must not be `null`","messagePattern":"`btf` 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":245,"sourceCode":"     * @param offset bitfield offset\n     * @param value the value\n     * @return the current {@code BitFieldArgs}\n     */\n    public BitFieldArgs incrBy(BitFieldType bitFieldType, int offset, long value) {\n        return incrBy(bitFieldType, new Offset(false, offset), value);\n    }\n\n    /**\n     * Adds a new {@code INCRBY} subcommand.\n     *\n     * @param bft the bit field type, must not be {@code null}.\n     * @param offset bitfield offset, must not be {@code null}.\n     * @param value the value\n     * @return the current {@code BitFieldArgs}\n     */\n    public BitFieldArgs incrBy(BitFieldType bft, Offset offset, long value) {\n        if (bft == null) {\n            throw new IllegalArgumentException(\"`btf` must not be `null`\");\n        }\n        if (offset == null) {\n            throw new IllegalArgumentException(\"`offset` must not be `null`\");\n        }\n        this.previousBitFieldType = bft;\n        this.commands.addAll(List.of(\"INCRBY\", bft.toString(), offset.toString(), Long.toString(value)));\n        return this;\n    }\n\n    /**\n     * Adds a new {@code INCRBY} subcommand using the field type of the previous command.\n     *\n     * @param offset bitfield offset\n     * @param value the value\n     * @return a new {@code INCRBY} subcommand for the given {@code bitFieldType}, {@code offset} and {@code value}.\n     * @throws IllegalStateException if no previous field type was found\n     */\n    public BitFieldArgs incrBy(int offset, long value) {","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/bitmap/BitFieldArgs.java#L227-L263","documentation":"BitFieldArgs.incrBy() validates its BitFieldType parameter and throws IllegalArgumentException when it is null, because the INCRBY sub-command requires the type encoding string. (Note the message says `btf` while the parameter is named `bft` — same check.)","triggerScenarios":"args.incrBy(null, offset, delta), typically from a null field type resolved from a lookup or an uninitialized variable.","commonSituations":"Field-type map miss; config missing a type name; code path where the previous field type was assumed non-null.","solutions":["Pass a valid BitFieldType (e.g. BitFieldArgs.BitFieldType.unsignedIn8())","Default the type when the lookup returns null","Null-check before calling incrBy()"],"exampleFix":"// before\nargs.incrBy(typeByName.get(\"counter\"), offset, 1); // get may return null\n// after\nBitFieldArgs.BitFieldType type = typeByName.get(\"counter\");\nif (type == null) { type = BitFieldArgs.BitFieldType.unsignedIn8(); }\nargs.incrBy(type, offset, 1);","handlingStrategy":"type-guard","validationCode":"Objects.requireNonNull(bft, \"BitFieldType required\");\nObjects.requireNonNull(offset, \"offset required\");\nargs.incrBy(bft, offset, value);","typeGuard":"static boolean canIncrBy(BitFieldArgs.BitFieldType t, BitFieldArgs.Offset o) { return t != null && o != null; }","tryCatchPattern":"try { args.incrBy(bft, offset, delta); } catch (IllegalArgumentException e) { log.error(\"incrBy rejected: \" + e.getMessage()); }","preventionTips":["Default field types when lookups miss","Null-check both type and offset before incrBy","Use static BitFieldType constants"],"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"}