{"record":{"id":"b2d4c215e44df8f3","repo":"apache/hadoop","slug":"expiration-expiry-tostring-is-too-far-in-the-fut","errorCode":null,"errorMessage":"Expiration expiry.toString() is too far in the future!","messagePattern":"Expiration expiry\\.toString\\(\\) 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":441,"sourceCode":"      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\n   * @throws InvalidRequestException if the pool does not have enough capacity\n   */\n  private void checkLimit(CachePool pool, String path,\n      short replication) throws InvalidRequestException {\n    CacheDirectiveStats stats = computeNeeded(path, replication);","sourceCodeStart":423,"sourceCodeEnd":459,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/CacheManager.java#L423-L459","documentation":"Error \"Expiration expiry.toString() is too far in the future!\" thrown in apache/hadoop.","triggerScenarios":"modifyCacheDirective with a relative expiration time that resolves too far in the future.","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"}