apache/druid · error · IllegalStateException

Could not create temp distribution directory.

Error message

Could not create temp distribution directory.

What it means

Before collecting sub-task distributions, the runner creates a 'dimension_distributions' directory under the task's temp dir. Failure to create it (IOException from FileUtils.mkdirp) is wrapped in this ISE.

Source

Thrown at indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionDistributionParallelIndexTaskRunner.java:266

    try {
      allReportsProcessedPhaser.arriveAndAwaitAdvance();
      executor.shutdownNow();
    }
    catch (Exception e) {
      throw new ISE(e, "Exception while waiting to extract distributions.");
    }
  }

  private File createDistributionsDir()
  {
    File taskTempDir = getToolbox().getConfig().getTaskTempDir(getTaskId());
    File distributionsDir = new File(taskTempDir, "dimension_distributions");
    try {
      FileUtils.mkdirp(distributionsDir);
      return distributionsDir;
    }
    catch (IOException e) {
      throw new ISE(e, "Could not create temp distribution directory.");
    }
  }

  private void cleanupDistributionsDir()
  {
    try {
      FileUtils.deleteDirectory(tempDistributionsDir);
    }
    catch (IOException e) {
      log.warn(e, "Could not delete temp distribution directory.");
    }
  }

  private String toIntervalString(Interval interval)
  {
    return
        new DateTime(interval.getStartMillis(), interval.getChronology())
        + "_"

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Check permissions and ownership of the task base dir (druid.indexer.task.baseTaskDir) for the worker user.
  2. Free disk space or remount the volume if it is full or read-only.
  3. Remove any stale file at the <taskTempDir>/dimension_distributions path and retry.
Defensive patterns

Strategy: validation

Validate before calling

// before starting tasks
File base = new File(baseTaskDirPath);
if (!base.isDirectory() || !base.canWrite()) {
  throw new IllegalStateException("Task base dir missing or not writable: " + base);
}

Try / catch

catch (IllegalStateException e) { if (e.getMessage().contains("Could not create temp distribution directory")) { checkPermissionsAndDisk(baseTaskDir); } else { throw e; } }

Prevention

When it happens

Trigger: mkdirp fails because the parent task temp dir is not writable, the path exists as a regular file, or the disk/filesystem is full or read-only.

Common situations: Wrong permissions on druid.indexer.task.baseTaskDir; running workers as a different user after an upgrade; disk full on the worker node; a stale file occupying the directory path.

Understand the failure class

Background: mkdir permission denied (EACCES): failed to create directory errors explained — this error's family across 32 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/e3f5af375a01f122. Report an issue: GitHub.