{"record":{"id":"8b2125994dfbbf68","repo":"apache/cassandra","slug":"request-on-table-s-s-with-sttl-of-d-seconds-ex","errorCode":null,"errorMessage":"Request on table %s.%s with %sttl of %d seconds exceeds maximum supported expiration date of %s. In order to avoid this use a lower TTL, change the expiration date overflow policy or upgrade to a version where this limitation is fixed. See CASSANDRA-14092 and CASSANDRA-14227 for more details.","messagePattern":"Request on table (.+?)\\.(.+?) with (.+?)ttl of (.+?) seconds exceeds maximum supported expiration date of (.+?)\\. In order to avoid this use a lower TTL, change the expiration date overflow policy or upgrade to a version where this limitation is fixed\\. See CASSANDRA-14092 and CASSANDRA-14227 for more details\\.","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/ExpirationDateOverflowHandling.java","lineNumber":105,"sourceCode":"                case CAP:\n                    ClientWarn.instance.warn(MessageFormatter.arrayFormat(MAXIMUM_EXPIRATION_DATE_EXCEEDED_WARNING, new Object[] { metadata.keyspace,\n                                                                                                                                   metadata.name,\n                                                                                                                                   isDefaultTTL? \"default \" : \"\",\n                                                                                                                                   ttl,\n                                                                                                                                   getMaxExpirationDateTS()})\n                                                             .getMessage());\n                case CAP_NOWARN:\n                    /**\n                     * Capping at this stage is basically not rejecting the request. The actual capping is done\n                     * by {@link #computeLocalExpirationTime(long, int)}, which converts the negative TTL\n                     * to {@link org.apache.cassandra.db.BufferExpiringCell#MAX_DELETION_TIME}\n                     */\n                    NoSpamLogger.log(logger, NoSpamLogger.Level.WARN, EXPIRATION_OVERFLOW_WARNING_INTERVAL_MINUTES, TimeUnit.MINUTES, MAXIMUM_EXPIRATION_DATE_EXCEEDED_WARNING,\n                                     metadata.keyspace, metadata.name, isDefaultTTL? \"default \" : \"\", ttl, getMaxExpirationDateTS());\n                    return;\n\n                default:\n                    throw new InvalidRequestException(String.format(MAXIMUM_EXPIRATION_DATE_EXCEEDED_REJECT_MESSAGE, metadata.keyspace, metadata.name,\n                                                                    isDefaultTTL? \"default \" : \"\", ttl, getMaxExpirationDateTS()));\n            }\n        }\n    }\n\n    /**\n     * This method computes the {@link Cell#localDeletionTime()}, maybe capping to the maximum representable value\n     * which is {@link Cell#MAX_DELETION_TIME}.\n     *\n     * Please note that the {@link ExpirationDateOverflowHandling.ExpirationDateOverflowPolicy} is applied\n     * during {@link ExpirationDateOverflowHandling#maybeApplyExpirationDateOverflowPolicy(org.apache.cassandra.schema.TableMetadata, int, boolean)},\n     * so if the request was not denied it means its expiration date should be capped.\n     *\n     * See CASSANDRA-14092\n     */\n    public static long computeLocalExpirationTime(long nowInSec, int timeToLive)\n    {\n","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/ExpirationDateOverflowHandling.java#L87-L123","documentation":"When a write's TTL (with its local expiration timestamp) would produce an expiration date beyond the maximum representable value, and the configured policy is EXPIRATION_DATE_OVERFLOW_POLICY = REJECT, ExpirationDateOverflowHandling.maybeApplyExpirationDateOverflowPolicy throws InvalidRequestException, rejecting the write (INSERT/UPDATE with TTL).","triggerScenarios":"An INSERT/UPDATE (or batch) sets a very large TTL (default TTL exceeding max_expiration_date_overflow_policy limits, or explicit USING TTL <n>) such that localExpirationTime + ttl exceeds MAXIMUM_EXPIRATION_DATE (~2038/2106 boundary depending on build).","commonSituations":"Misconfigured default TTL of huge values (e.g. ttl_in_seconds = 630720000 with REJECT policy and an older build); application code passing seconds-in-decades as TTL; clusters that predate the CASSANDRA-14092/14227 fixes where the maximum expiration is capped at 2038 (int seconds).","solutions":["Lower the TTL in the write (or in ttl_in_seconds default) so the expiration date stays within the maximum (e.g. use seconds not decades).","Change expiration_date_overflow_policy in cassandra.yaml from REJECT to CAP (or WARN) if clamping the expiration is acceptable.","Upgrade to a fixed version where the maximum supported expiration date is extended (CASSANDRA-14092/CASSANDRA-14227).","Fix application code that computes TTL (e.g. passing epoch-based seconds instead of a relative TTL)."],"exampleFix":"// before: rejected write\nINSERT INTO sensors (id, temp) VALUES (1, 20.5) USING TTL 630720000;\n// after: smaller TTL within supported range\nINSERT INTO sensors (id, temp) VALUES (1, 20.5) USING TTL 31536000;","handlingStrategy":"validation","validationCode":"int maxTtl = (int) ((ExpirationDateOverflowHandling.getMaxExpirationDateTS() - System.currentTimeMillis()) / 1000);\nif (ttl > maxTtl) ttl = maxTtl; // or reject client-side\n","typeGuard":null,"tryCatchPattern":"try {\n    session.execute(insertWithTtl(ttl));\n} catch (InvalidRequestException e) {\n    if (e.getMessage().contains(\"exceeds maximum supported expiration date\"))\n        retryWithClampedTtl(ttl); // lower TTL or use CAP policy server-side\n    else throw e;\n}\n","preventionTips":["Compute TTLs as relative seconds, never epoch-like absolute values.","Set expiration_date_overflow_policy=CAP if clamping is acceptable for your workload.","Cap TTL at the application layer (e.g. max 20 years minus clock skew).","Upgrade past CASSANDRA-14092/14227 fixes for extended max expiration dates."],"tags":["ttl","invalid-request","expiration","configuration"],"backgroundTag":"value-out-of-range","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}