apache/druid · error
Failed to read log for task: %s
Error message
Failed to read log for task: %s
What it means
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.
Source
Thrown at indexing-service/src/main/java/org/apache/druid/indexing/worker/http/WorkerResource.java:194
return Response.status(501)
.type(MediaType.TEXT_PLAIN)
.entity(StringUtils.format(
"Log streaming not supported by [%s]",
taskRunner.getClass().getName()
))
.build();
}
try {
final Optional<InputStream> stream = ((TaskLogStreamer) taskRunner).streamTaskLog(taskId, offset);
if (stream.isPresent()) {
return Response.ok(stream.get()).build();
} else {
return Response.status(Response.Status.NOT_FOUND).build();
}
}
catch (IOException e) {
log.warn(e, "Failed to read log for task: %s", taskId);
return Response.serverError().build();
}
}
}
View on GitHub (pinned to 9b90983fd2)
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
Defensive patterns
Strategy: try-catch
Validate before calling
// Check the task exists on this worker first
// GET /druid/worker/v1/task/{taskId}/status -> 200 Try / catch
try { workerLog(taskId); } catch (WebApplicationException e) { if (e.getResponse().getStatus() == 500) { /* read the log file directly from druid.indexer.logs.directory */ } } Prevention
- Stream logs before retention cleanup
- Ensure druid.indexer.logs.directory is correct and readable
- Monitor worker disk/filesystem health
When it happens
Trigger: GET /druid/worker/v1/task/{taskId}/log when opening/reading the task log file (TaskLogStreamer/log task dir) throws IOException.
Common situations: Log file deleted or rotated while streaming; wrong druid.indexer.logs.directory; filesystem permissions or disk errors on the worker.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- Failed to stream logs from: %s
- Failed to stream logs for task[%s] starting at offset[%d]
- Failed to stream log for task %s
- User [%s] does not exist.
- User [%s] already exists.
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/5cd6b98c57ca0757.
Report an issue: GitHub.