eclipse-vertx/vert.x · error · IllegalStateException

cacheDir has been removed. FileResolver is closing?

Error message

cacheDir has been removed. FileResolver is closing?

What it means

Lifecycle guard in FileCache.getCacheDir: the internal cacheDir reference has been nulled (set to null) because the FileResolver that owns this cache is closing/shut down. Any cache operation reaching this method after shutdown fails fast instead of using a removed directory; the message is a sentinel, no dynamic input.

Source

Thrown at vertx-core/src/main/java/io/vertx/core/file/impl/FileCache.java:252

    }
  }

  void cacheDir(String fileName) throws IOException {
    File file = new File(getCacheDir(), fileName);
    fileNameCheck(file);
    file.mkdirs();
  }

  private void fileNameCheck(File file) throws IOException {
    if (!file.getCanonicalFile().toPath().startsWith(getCacheDir().toPath())) {
      throw new VertxException("File is outside of the cacheDir dir: " + file);
    }
  }

  private File getCacheDir() {
    File currentCacheDir = cacheDir;
    if (currentCacheDir == null) {
      throw new IllegalStateException("cacheDir has been removed. FileResolver is closing?");
    }
    return currentCacheDir;
  }
}

View on GitHub (pinned to fb308bd8c3)

Solutions

  1. Stop issuing file resolution/caching operations before closing the FileResolver/Vertx
  2. Check the Vertx/FileResolver lifecycle and order shutdown after all file work completes
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at vertx-core/src/main/java/io/vertx/core/file/impl/FileCache.java:252 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of eclipse-vertx/vert.x@fb308bd8c3 (2026-09-06). Data as JSON: /api/errors/5cd40a9a38c995bc. Report an issue: GitHub.