{"record":{"id":"e10cd2a662cf7a93","repo":"apache/hadoop","slug":"expiration-expiry-tostring-is-too-far-in-the-f","errorCode":null,"errorMessage":"Expiration {expiry.toString()} is too far in the future!","messagePattern":"Expiration (.+?) is too far in the future!","errorType":"exception","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/CacheManager.java","lineNumber":436,"sourceCode":"    if (info == null || info.getExpiration() == null) {\n      return maxAbsoluteExpiryTime;\n    }\n    Expiration expiry = info.getExpiration();\n    if (expiry.getMillis() < 0l) {\n      throw new InvalidRequestException(\"Cannot set a negative expiration: \"\n          + expiry.getMillis());\n    }\n    long relExpiryTime, absExpiryTime;\n    if (expiry.isRelative()) {\n      relExpiryTime = expiry.getMillis();\n      absExpiryTime = now + relExpiryTime;\n    } else {\n      absExpiryTime = expiry.getMillis();\n      relExpiryTime = absExpiryTime - now;\n    }\n    // Need to cap the expiry so we don't overflow a long when doing math\n    if (relExpiryTime > Expiration.MAX_RELATIVE_EXPIRY_MS) {\n      throw new InvalidRequestException(\"Expiration \"\n          + expiry.toString() + \" is too far in the future!\");\n    }\n    // Fail if the requested expiry is greater than the max\n    if (relExpiryTime > maxRelativeExpiryTime) {\n      throw new InvalidRequestException(\"Expiration \" + expiry.toString()\n          + \" exceeds the max relative expiration time of \"\n          + maxRelativeExpiryTime + \" ms.\");\n    }\n    return absExpiryTime;\n  }\n\n  /**\n   * Throws an exception if the CachePool does not have enough capacity to\n   * cache the given path at the replication factor.\n   *\n   * @param pool CachePool where the path is being cached\n   * @param path Path that is being cached\n   * @param replication Replication factor of the path","sourceCodeStart":418,"sourceCodeEnd":454,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/CacheManager.java#L418-L454","documentation":"Error \"Expiration {expiry.toString()} is too far in the future!\" thrown in apache/hadoop.","triggerScenarios":"addCacheDirective/modify with an expiration time beyond the allowed maximum future limit.","commonSituations":"See trigger scenarios.","solutions":["Choose a nearer expiration time for the cache directive, or use 'never' for no expiry."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}