{"record":{"id":"7f8e0f5a22f80027","repo":"quarkusio/quarkus","slug":"timeout-must-not-be-null-7f8e0f","errorCode":null,"errorMessage":"`timeout` must not be `null`","messagePattern":"`timeout` must not be `null`","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/value/GetExArgs.java","lineNumber":40,"sourceCode":"     * Set the expiration timeout, in seconds.\n     *\n     * @param timeout expiration timeout in seconds\n     * @return the current {@code GetExArgs}\n     */\n    public GetExArgs ex(long timeout) {\n        this.ex = timeout;\n        return this;\n    }\n\n    /**\n     * Set the expiration timeout, in seconds.\n     *\n     * @param timeout expiration timeout in seconds\n     * @return the current {@code GetExArgs}\n     */\n    public GetExArgs ex(Duration timeout) {\n        if (timeout == null) {\n            throw new IllegalArgumentException(\"`timeout` must not be `null`\");\n        }\n        return ex(timeout.toSeconds());\n    }\n\n    /**\n     * Set the expiration timestamp as a number of seconds since the Unix epoch.\n     *\n     * @param timestamp the timestamp\n     * @return the current {@code GetExArgs}\n     */\n    public GetExArgs exAt(long timestamp) {\n        this.exAt = timestamp;\n        return this;\n    }\n\n    /**\n     * Set the expiration timestamp as a number of seconds since the Unix epoch.\n     *","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/datasource/value/GetExArgs.java#L22-L58","documentation":"GetExArgs.ex(Duration) sets a seconds-based expiration for GETEX and calls timeout.toSeconds(). A null Duration cannot be converted, so the library throws IllegalArgumentException immediately. It indicates the caller omitted the expiration value.","triggerScenarios":"Calling GetExArgs.ex(null) — commonly when the Duration comes from an optional config property or a nullable method parameter.","commonSituations":"Missing configuration for a TTL default; a Duration field left uninitialized; passing a value from a downstream API that returned null instead of a default TTL.","solutions":["Pass a non-null Duration, e.g. GetExArgs.INSTANCE.ex(Duration.ofSeconds(30))","Apply a default TTL when the configured value is null","Validate the Duration at your service boundary before invoking Redis"],"exampleFix":"// before\nGetExArgs args = GetExArgs.INSTANCE.ex(ttl); // ttl may be null\n// after\nGetExArgs args = ttl != null\n    ? GetExArgs.INSTANCE.ex(ttl)\n    : GetExArgs.INSTANCE.ex(Duration.ofSeconds(60));","handlingStrategy":"validation","validationCode":"if (timeout == null) {\n    throw new IllegalArgumentException(\"timeout is required before GetExArgs.ex()\");\n}\nGetExArgs.INSTANCE.ex(timeout);","typeGuard":"boolean hasTtl(Duration d) { return d != null && !d.isNegative() && !d.isZero(); }","tryCatchPattern":"try {\n    redis.value().getset(key, value, GetExArgs.INSTANCE.ex(timeout));\n} catch (IllegalArgumentException e) {\n    throw new IllegalStateException(\"TTL not configured for GETEX: \" + e.getMessage(), e);\n}","preventionTips":["Set a default TTL in configuration so the Duration is never null","Check Optional<Duration> with orElse(defaultTtl) before calling ex()","Fail fast on null TTLs at the repository/service boundary"],"tags":["java","redis","null-argument","validation"],"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"}