{"record":{"id":"ff0693424cc80d60","repo":"apache/druid","slug":"exception-while-writing-distribution-file-for-inte","errorCode":null,"errorMessage":"Exception while writing distribution file for interval [%s], task [%s]","messagePattern":"Exception while writing distribution file for interval \\[(.+?)\\], task \\[(.+?)\\]","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionDistributionParallelIndexTaskRunner.java","lineNumber":215,"sourceCode":"      String subTaskId,\n      StringDistribution distribution\n  )\n  {\n    try {\n      File intervalDir = getIntervalDistributionDir(interval);\n      FileUtils.mkdirp(intervalDir);\n\n      File distributionJsonFile = getDistributionJsonFile(intervalDir, subTaskId);\n      getToolbox().getJsonMapper().writeValue(distributionJsonFile, distribution);\n    }\n    catch (IOException e) {\n      String errorMsg = StringUtils.format(\n          \"Exception while writing distribution file for interval [%s], task [%s]\",\n          interval,\n          subTaskId\n      );\n      stopGracefully(errorMsg);\n      throw new ISE(e, errorMsg);\n    }\n  }\n\n  private StringDistribution readDistributionFromFile(File intervalDir, String subTaskId)\n  {\n    try {\n      File distributionJsonFile = getDistributionJsonFile(intervalDir, subTaskId);\n      return getToolbox().getJsonMapper().readValue(distributionJsonFile, StringDistribution.class);\n    }\n    catch (IOException e) {\n      throw new ISE(e, \"Error while reading distribution for interval [%s], task [%s]\",\n                    intervalDir.getName(), subTaskId\n      );\n    }\n  }\n\n  private File getIntervalDistributionDir(Interval interval)\n  {","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/parallel/PartialDimensionDistributionParallelIndexTaskRunner.java#L197-L233","documentation":"The dimension-distribution phase runner persists each sub-task's StringDistribution to a JSON file under the task's temp dir. If writing that file throws an IOException, the runner stops gracefully and rethrows ISE wrapping the original exception, naming the interval and sub-task.","triggerScenarios":"IOException while writing the distribution JSON for a sub-task's interval: disk full, task temp dir removed mid-run, or filesystem permission issues.","commonSituations":"Middle Manager / indexer nodes running out of disk space; tmp reaper or cleanup job deleting druid task temp dirs while the task runs; container ephemeral storage limits exceeded.","solutions":["Free disk space on the worker or increase the task's temp/storage allocation, then retry the task.","Check the wrapped cause (the IOException) in the stack trace for the precise filesystem error.","Ensure nothing external (cleanup jobs, tmpwatch) deletes Druid task temp directories during task execution.","Verify write permissions on the configured druid.indexer.task.baseTaskDir."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (IllegalStateException e) { if (e.getMessage().contains(\"Exception while writing distribution file\")) { checkDiskSpace(); retryTask(); } else { throw e; } }","preventionTips":["Monitor disk usage on Middle Manager / indexer nodes.","Exclude Druid task temp dirs from external cleanup jobs (tmpwatch, systemd-tmpfiles).","Size task base dirs generously for range-partitioned batch jobs."],"tags":["druid","io","disk","batch-ingestion"],"backgroundTag":"file-write-failed","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}