{"record":{"id":"78dfc16c7c358ed8","repo":"quarkusio/quarkus","slug":"the-bitfieldtype-must-not-be-null","errorCode":null,"errorMessage":"The BitFieldType must not be `null`","messagePattern":"The BitFieldType 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":178,"sourceCode":"     * @param offset bitfield offset\n     * @param value the value\n     * @return the current {@code BitFieldArgs}\n     */\n    public BitFieldArgs set(BitFieldType bft, int offset, long value) {\n        return set(bft, new Offset(false, offset), value);\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, must not be {@code null}.\n     * @param value the value\n     * @return the current {@code BitFieldArgs}\n     */\n    public BitFieldArgs set(BitFieldType bft, Offset offset, long value) {\n        if (bft == null) {\n            throw new IllegalArgumentException(\"The BitFieldType must not be `null`\");\n        }\n        if (offset.offset < 0) {\n            throw new IllegalArgumentException(\"The offset must be greater or equals to 0\");\n        }\n\n        this.previousBitFieldType = bft;\n        this.commands.addAll(List.of(\"SET\", bft.toString(), offset.toString(), Long.toString(value)));\n        return this;\n    }\n\n    /**\n     * Adds a new {@code SET} subcommand using offset {@code 0} and the field type of the previous command.\n     *\n     * @param value the value\n     * @return the current {@code BitFieldArgs}\n     * @throws IllegalStateException if no previous field type was found\n     */\n    public BitFieldArgs set(long value) {","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/bitmap/BitFieldArgs.java#L160-L196","documentation":"BitFieldArgs.set() validates the BitFieldType before emitting the SET sub-command. A null type is rejected with IllegalArgumentException because the type string (e.g. \"i8\") is required in the Redis command.","triggerScenarios":"args.set(null, offset, value), usually when the BitFieldType came from a cache/lookup that returned null or from an uninitialized field.","commonSituations":"Field type resolved from config that is absent; null returned by a map lookup; variable declared but never assigned.","solutions":["Pass a non-null BitFieldType such as BitFieldArgs.BitFieldType.signIn8()","Resolve a default field type when the configured one is missing","Check for null before invoking set()"],"exampleFix":"// before\nBitFieldArgs.BitFieldType type = types.get(name); // may be null\nargs.set(type, offset, value);\n// after\nBitFieldArgs.BitFieldType type = types.getOrDefault(name, BitFieldArgs.BitFieldType.unsignedIn8());\nargs.set(type, offset, value);","handlingStrategy":"type-guard","validationCode":"Objects.requireNonNull(bft, \"BitFieldType required\");\nargs.set(bft, offset, value);","typeGuard":"static boolean isNonNullType(BitFieldArgs.BitFieldType t) { return t != null; }","tryCatchPattern":"try { args.set(bft, offset, value); } catch (IllegalArgumentException e) { args.set(BitFieldArgs.BitFieldType.unsignedIn8(), offset, value); }","preventionTips":["Default field types with getOrDefault on lookups","Use static BitFieldType constants instead of dynamically resolved ones","Fail fast on missing type config at startup"],"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-14T00:17:10.932Z"}