stanfordnlp/CoreNLP · warning · IllegalArgumentException

Deleting more than 10GB; you should do this manually

Error message

Deleting more than 10GB; you should do this manually

What it means

deleteRecursively sums the byte size of every file it would remove and throws this IllegalArgumentException if the total exceeds 10 GB (10000000000L), again to make bulk deletion an explicit manual action.

Solutions

  1. Delete the large directory manually after verifying its contents
  2. Implement your own guarded recursive delete with a limit appropriate to your app
  3. Free space selectively by deleting individual files rather than the whole tree

Example fix

// before
IOUtils.deleteRecursively(checkpointDir); // 30 GB
// after
// explicitly verified: only .ckpt files inside
for (File f : checkpointDir.listFiles((d, n) -> n.endsWith(".ckpt"))) { f.delete(); }
checkpointDir.delete();
Defensive patterns

Strategy: try-catch

Validate before calling

long total = 0; try (var s = Files.walk(dir.toPath())) { total = s.filter(Files::isRegularFile).mapToLong(p -> p.toFile().length()).sum(); } if (total > 10_000_000_000L) { /* manual deletion */ }

Try / catch

try { IOUtils.deleteRecursively(dir); } catch (IllegalArgumentException e) { if (e.getMessage().contains("more than 10GB")) { /* manual deletion */ } else throw e; }

Prevention

When it happens

Trigger: IOUtils.deleteRecursively on a directory containing more than 10 GB of files, even if the file count is under 100.

Common situations: Deleting model checkpoints, video caches, or large datasets with few but huge files; log directories that grew fat with a handful of files.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/fba9a3a1cf94f5fa. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/io/IOUtils.java:2039

   *
   * @param file The file or directory to delete.
   */
  public static void deleteRecursively(File file) {
    // Sanity checks
    if (blockListPathsToRemove.contains(file.getPath())) {
      throw new IllegalArgumentException("You're trying to delete " + file + "! I _really_ don't think you want to do that...");
    }
    int count = 0;
    long size = 0;
    for (File f : iterFilesRecursive(file)) {
      count += 1;
      size += f.length();
    }
    if (count > 100) {
      throw new IllegalArgumentException("Deleting more than 100 files; you should do this manually");
    }
    if (size > 10000000000L) {  // 10 GB
      throw new IllegalArgumentException("Deleting more than 10GB; you should do this manually");
    }
    // Do delete
    if (file.isDirectory()) {
      File[] children = file.listFiles();
      if (children != null) {
        for (File child : children) {
          deleteRecursively(child);
        }
      }
    }
    //noinspection ResultOfMethodCallIgnored
    file.delete();
  }

  /**
   * Start a simple console. Read lines from stdin, and pass each line to the callback.
   * Returns on typing "exit" or "quit".
   *

View on GitHub (pinned to 1b7edd19c4)