apache/dolphinscheduler · error · RuntimeException
Read file: %s error
Error message
Read file: %s error
What it means
LogUtils.readPartFileContentFromLocal reads a slice (skipLine..skipLine+limit) of a local log file using Files.lines. If the file exists but an IOException occurs while streaming its lines, the IOException is logged and rethrown as a RuntimeException 'Read file: <path> error'. It indicates an I/O-level failure (permissions, file deleted mid-read, I/O error), not a missing file.
Source
Thrown at dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/LogUtils.java:73
}
return new byte[0];
}
public static byte[] getFileContentBytesFromRemote(String filePath) {
RemoteLogUtils.getRemoteLog(filePath);
return getFileContentBytesFromLocal(filePath);
}
public static List<String> readPartFileContentFromLocal(String filePath,
int skipLine,
int limit) {
File file = new File(filePath);
if (file.exists() && file.isFile()) {
try (Stream<String> stream = Files.lines(Paths.get(filePath))) {
return stream.skip(skipLine).limit(limit).collect(Collectors.toList());
} catch (IOException e) {
log.error("read file error", e);
throw new RuntimeException(String.format("Read file: %s error", filePath), e);
}
} else {
throw new RuntimeException("The file path: " + filePath + " not exists");
}
}
public static List<String> readPartFileContentFromRemote(String filePath,
int skipLine,
int limit) {
RemoteLogUtils.getRemoteLog(filePath);
return readPartFileContentFromLocal(filePath, skipLine, limit);
}
public static String rollViewLogLines(List<String> lines) {
StringBuilder builder = new StringBuilder();
final int MaxResponseLogSize = 65535;
int totalLogByteSize = 0;
for (String line : lines) {View on GitHub (pinned to 02eac45a1b)
Solutions
- Check the logged cause above the throw to see the concrete IOException reason
- Verify the process user has read permission on the file and its parent directories
- Confirm the file still exists and the storage mount is healthy before reading
- Increase file descriptor limits if 'Too many open files' appears in the cause
- Retry the read, or treat the file as gone and return an empty list/partial content to the UI
Example fix
// before
List<String> lines = LogUtils.readPartFileContentFromLocal(path, skip, limit);
// after
try {
List<String> lines = LogUtils.readPartFileContentFromLocal(path, skip, limit);
} catch (RuntimeException e) {
log.warn("Log file unreadable: {}", path, e);
return Collections.emptyList();
} Defensive patterns
Strategy: try-catch
Validate before calling
if (!Files.isReadable(Paths.get(filePath))) { throw new IllegalStateException("Log file not readable: " + filePath); } Try / catch
try {
List<String> lines = LogUtils.readPartFileContentFromLocal(filePath, skip, limit);
} catch (RuntimeException e) {
log.warn("Failed to read log slice from {}: {}", filePath, e.getCause());
lines = Collections.emptyList();
} Prevention
- Run master/worker/service processes as users with read access to log directories
- Do not delete/rotate a log file while UI queries may still read it — use retention windows
- Monitor storage mounts and fd limits on worker hosts
- Read the wrapped cause for the concrete IOException before retrying
When it happens
Trigger: Calling readPartFileContentFromLocal(filePath, skipLine, limit) when Files.lines throws IOException: unreadable permissions, file removed/truncated between the exists() check and the read, device I/O error, or too many open files.
Common situations: Log viewer in DolphinScheduler reading a task log that was rotated/cleaned up by log-retention jobs while still referenced; running the service as a user lacking read permission on worker log directories; NFS/NAS mounts that dropped.
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
- Read sql content from resource file %s error
- Create xlsx directory error
- generate excel error
- java.lang.CloneNotSupportedException
- Update the resource file from content: {fileAbsolutePath} fa
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/f360844dbbafb0b7.
Report an issue: GitHub.