{"record":{"id":"f7e5ae4ac31b6342","repo":"apache/cassandra","slug":"request-on-table-with-ttl-of-seconds-ex","errorCode":null,"errorMessage":"Request on table {}.{} with {}ttl of {} seconds exceeds maximum supported expiration date of {} and will have its expiration capped to that date. In order to avoid this use a lower TTL 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 (.+?) and will have its expiration capped to that date\\. In order to avoid this use a lower TTL or upgrade to a version where this limitation is fixed\\. See CASSANDRA-14092 and CASSANDRA-14227 for more details\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/java/org/apache/cassandra/db/ExpirationDateOverflowHandling.java","lineNumber":88,"sourceCode":"\n    public static final String MAXIMUM_EXPIRATION_DATE_EXCEEDED_REJECT_MESSAGE = \"Request on table %s.%s with %sttl of %d seconds exceeds maximum supported expiration \" +\n                                                                                 \"date of %s. In order to avoid this use a lower TTL, change \" +\n                                                                                 \"the expiration date overflow policy or upgrade to a version where this limitation \" +\n                                                                                 \"is fixed. See CASSANDRA-14092 and CASSANDRA-14227 for more details.\";\n\n    public static void maybeApplyExpirationDateOverflowPolicy(TableMetadata metadata, int ttl, boolean isDefaultTTL) throws InvalidRequestException\n    {\n        if (ttl == BufferCell.NO_TTL)\n            return;\n\n        // Check for localExpirationTime overflow (CASSANDRA-14092) to apply a policy if needed\n        long nowInSecs = currentTimeMillis() / 1000;\n        if (((long) ttl + nowInSecs) > Cell.getVersionedMaxDeletiontionTime())\n        {\n            switch (policy)\n            {\n                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()));","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/ExpirationDateOverflowHandling.java#L70-L106","documentation":"Cassandra stores expirations as local seconds with a maximum representable deletion time (2038-related limit). When TTL + now exceeds that maximum, under the CAP policy the write proceeds but its expiration is capped at the max date, and a warning is sent to the client explaining the cap and pointing to CASSANDRA-14092/14227.","triggerScenarios":"Any write (INSERT/UPDATE with USING TTL, or default table TTL) where (long) ttl + nowInSecs exceeds Cell.getVersionedMaxDeletiontionTime() while expirations overflow policy is CAP; large TTLs (e.g. > ~20 years) or large default_ttl table settings.","commonSituations":"Tables configured with very high default_ttl; applications writing 'infinite' TTLs like TTL 2147483647; clusters approaching the 2038 ceiling as time passes.","solutions":["Lower the TTL in the write or the table's default_ttl so ttl + now stays under the maximum expiration date.","Check cassandra.yaml expiration_date_overflow_policy; CAP_NOWARN silently caps if the warning noise is unwanted (data still capped).","Upgrade to a version where the expiration-date limitation is fixed (per CASSANDRA-14092/CASSANDRA-14227)."],"exampleFix":"// before\nINSERT INTO ks.t (k, v) VALUES (1, 'x') USING TTL 2147483647;\n// after\nINSERT INTO ks.t (k, v) VALUES (1, 'x') USING TTL 630720000; // 20 years","handlingStrategy":"validation","validationCode":"long maxDeletionTime = Cell.getVersionedMaxDeletiontionTime();\nlong nowInSecs = System.currentTimeMillis() / 1000;\nif (ttl + nowInSecs > maxDeletionTime) {\n    ttl = (int) Math.max(0, maxDeletionTime - nowInSecs); // clamp before write\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clamp application-side TTLs before writing; avoid sentinel TTLs like Integer.MAX_VALUE.","Audit default_ttl table settings periodically.","Track time-to-2038 exposure for long-lived TTL data and plan upgrades."],"tags":["ttl","expiration","client-warning","data-loss"],"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"}