{"record":{"id":"5cd6b98c57ca0757","repo":"apache/druid","slug":"failed-to-read-log-for-task-s","errorCode":null,"errorMessage":"Failed to read log for task: %s","messagePattern":"Failed to read log for task: (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"indexing-service/src/main/java/org/apache/druid/indexing/worker/http/WorkerResource.java","lineNumber":194,"sourceCode":"      return Response.status(501)\n                     .type(MediaType.TEXT_PLAIN)\n                     .entity(StringUtils.format(\n                         \"Log streaming not supported by [%s]\",\n                         taskRunner.getClass().getName()\n                     ))\n                     .build();\n    }\n    try {\n      final Optional<InputStream> stream = ((TaskLogStreamer) taskRunner).streamTaskLog(taskId, offset);\n\n      if (stream.isPresent()) {\n        return Response.ok(stream.get()).build();\n      } else {\n        return Response.status(Response.Status.NOT_FOUND).build();\n      }\n    }\n    catch (IOException e) {\n      log.warn(e, \"Failed to read log for task: %s\", taskId);\n      return Response.serverError().build();\n    }\n  }\n}\n","sourceCodeStart":176,"sourceCodeEnd":199,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/indexing-service/src/main/java/org/apache/druid/indexing/worker/http/WorkerResource.java#L176-L199","documentation":"The middle manager worker's log endpoint (GET /druid/worker/v1/task/{id}/log) failed with an IOException while reading or streaming the task's log file. The resource logs a warning and returns HTTP 500.","triggerScenarios":"GET /druid/worker/v1/task/{taskId}/log when opening/reading the task log file (TaskLogStreamer/log task dir) throws IOException.","commonSituations":"Log file deleted or rotated while streaming; wrong druid.indexer.logs.directory; filesystem permissions or disk errors on the worker.","solutions":["Check worker logs for the full IOException stack trace","Verify druid.indexer.logs.directory points at the location holding task logs and is readable","Ensure the task's log file exists on this worker and was not purged by log retention","Fix filesystem permissions or disk issues on the worker host"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Check the task exists on this worker first\n// GET /druid/worker/v1/task/{taskId}/status -> 200","typeGuard":null,"tryCatchPattern":"try { workerLog(taskId); } catch (WebApplicationException e) { if (e.getResponse().getStatus() == 500) { /* read the log file directly from druid.indexer.logs.directory */ } }","preventionTips":["Stream logs before retention cleanup","Ensure druid.indexer.logs.directory is correct and readable","Monitor worker disk/filesystem health"],"tags":["rest-api","io","task-logs"],"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-14T05:17:10.506Z"}