{"record":{"id":"b673e0f1f0905553","repo":"apache/druid","slug":"failed-to-stream-task-reports-for-task-s","errorCode":null,"errorMessage":"Failed to stream task reports for task %s","messagePattern":"Failed to stream task reports for task (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/OverlordResource.java","lineNumber":827,"sourceCode":"  public Response doGetReports(\n      @PathParam(\"taskid\") final String taskid\n  )\n  {\n    try {\n      final Optional<InputStream> stream = taskLogStreamer.streamTaskReports(taskid);\n      if (stream.isPresent()) {\n        return Response.ok(stream.get()).build();\n      } else {\n        return Response.status(Response.Status.NOT_FOUND)\n                       .entity(\n                           \"No task reports were found for this task. \"\n                           + \"The task may not exist, or it may not have completed yet.\"\n                       )\n                       .build();\n      }\n    }\n    catch (Exception e) {\n      log.warn(e, \"Failed to stream task reports for task %s\", taskid);\n      return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();\n    }\n  }\n\n  private <T> Response asLeaderWith(Optional<T> x, Function<T, Response> f)\n  {\n    if (x.isPresent()) {\n      return f.apply(x.get());\n    } else {\n      // Encourage client to try again soon, when we'll likely have a redirect set up\n      return Response.status(Response.Status.SERVICE_UNAVAILABLE).build();\n    }\n  }\n\n  @VisibleForTesting\n  Set<ResourceAction> getNeededResourceActionsForTask(Task task) throws UOE\n  {\n    final Set<ResourceAction> resourceActions = new HashSet<>();","sourceCodeStart":809,"sourceCodeEnd":845,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/indexing-service/src/main/java/org/apache/druid/indexing/overlord/http/OverlordResource.java#L809-L845","documentation":"The Overlord's task reports endpoint (GET /druid/indexer/v1/task/{id}/reports) hit an unexpected exception while fetching or streaming the task's reports. It logs the exception and returns HTTP 500 with no body.","triggerScenarios":"GET /druid/indexer/v1/task/{taskid}/reports when TaskReportFileGetter or the task's report storage throws while reading reports.","commonSituations":"MSQ/async query reports not yet written or already cleaned up; report directory misconfigured (druid.indexer.task.storage.type or directory); permission problems on the report directory.","solutions":["Check Overlord logs for the full stack trace","Verify task report storage config (druid.indexer.task.storage.type=local, storageDirectory) and permissions","Confirm the task has actually completed and written reports before fetching","Retry after the task finishes; re-run the query/task if reports were purged"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Ensure task is complete before fetching reports\n// status equals 'SUCCESS' from /druid/indexer/v1/task/{id}/status","typeGuard":null,"tryCatchPattern":"try { streamReports(taskId); } catch (WebApplicationException e) { if (e.getResponse().getStatus() == 500) { /* inspect report storage dir; retry or re-run task */ } }","preventionTips":["Wait for task completion before fetching reports","Configure druid.indexer.task.storage correctly with sufficient retention","Verify report directory permissions on overlord host"],"tags":["rest-api","task-reports"],"backgroundTag":"file-read-failed","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}