{"record":{"id":"b9adf00671eff956","repo":"quarkusio/quarkus","slug":"overflowtype-must-not-be-null","errorCode":null,"errorMessage":"`overflowType` must not be `null`","messagePattern":"`overflowType` 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":297,"sourceCode":"     * Adds a new {@code INCRBY} subcommand using offset {@code 0}.\n     *\n     * @param bitFieldType the bit field type, must not be {@code null}.\n     * @param value the value\n     * @return the current {@code BitFieldArgs}\n     */\n    public BitFieldArgs incrBy(BitFieldType bitFieldType, long value) {\n        return incrBy(bitFieldType, 0, value);\n    }\n\n    /**\n     * Adds a new {@code OVERFLOW} subcommand.\n     *\n     * @param overflowType type of overflow, must not be {@code null}.\n     * @return the current {@code BitFieldArgs}\n     */\n    public BitFieldArgs overflow(OverflowType overflowType) {\n        if (overflowType == null) {\n            throw new IllegalArgumentException(\"`overflowType` must not be `null`\");\n        }\n        this.commands.addAll(List.of(\"OVERFLOW\", overflowType.name()));\n        return this;\n    }\n\n    /**\n     * Creates a new signed {@link BitFieldType} for the given number of {@code bits}.\n     * Redis allows up to {@code 64} bits for unsigned integers.\n     *\n     * @param bits number of bits to define the integer type width.\n     * @return the {@link BitFieldType}.\n     */\n    public static BitFieldType signed(int bits) {\n        return new BitFieldType(true, bits);\n    }\n\n    /**\n     * Creates a new unsigned {@link BitFieldType} for the given number of {@code bits}. Redis allows up to {@code 63} bits for","sourceCodeStart":279,"sourceCodeEnd":315,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/bitmap/BitFieldArgs.java#L279-L315","documentation":"BitFieldArgs.overflow(OverflowType) builds the BITFIELD OVERFLOW sub-command and requires an explicit overflow type (WRAP, SAT, or FAIL). It throws this IllegalArgumentException when overflowType is null, preventing an OVERFLOW command with a missing argument from being sent to Redis.","triggerScenarios":"Calling bitFieldArgs.overflow(null), typically because the OverflowType came from an uninitialized variable, a lookup that missed (e.g. Enum.valueOf on an unknown string wrapped in try/catch returning null), or user/config input that was not mapped to an enum.","commonSituations":"Mapping a config string like \"wrap\" to OverflowType incorrectly (wrong case) so the lookup yields null; copying example code and dropping the enum argument; conditional selection of overflow policy where the else branch leaves it null.","solutions":["Pass an explicit OverflowType: OverflowType.WRAP, OverflowType.SAT, or OverflowType.FAIL.","If the type comes from a string, normalize case and use OverflowType.valueOf properly, with a default fallback.","Initialize the OverflowType variable before calling overflow()."],"exampleFix":"// before\nString s = config.getOverflow(); // \"WRAP\" or unset\nargs.overflow(s == null ? null : OverflowType.valueOf(s)); // throws when unset\n// after\nOverflowType t = config.getOverflow() == null ? OverflowType.WRAP : OverflowType.valueOf(config.getOverflow());\nargs.overflow(t);","handlingStrategy":"validation","validationCode":"if (overflowType == null) {\n    overflowType = io.quarkus.redis.datasource.bitmap.BitFieldArgs.OverflowType.WRAP; // sane default\n}\nargs.overflow(overflowType);","typeGuard":"boolean isValidOverflow(BitFieldArgs.OverflowType t) { return t == BitFieldArgs.OverflowType.WRAP || t == BitFieldArgs.OverflowType.SAT || t == BitFieldArgs.OverflowType.FAIL; }","tryCatchPattern":"try { args.overflow(type); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"overflowType\")) { args.overflow(BitFieldArgs.OverflowType.WRAP); } else { throw e; } }","preventionTips":["Never leave the OverflowType variable nullable; initialize to a default policy.","Map strings from config with OverflowType.valueOf(normalized) inside a fallback-aware helper.","Remember Redis defaults to WRAP, so omitting overflow() entirely is often fine."],"tags":["redis","argument-validation","null-argument"],"backgroundTag":"null-argument-passed","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"}