apache/dolphinscheduler · error · RuntimeException
The file path: + filePath + not exists
Error message
The file path: + filePath + not exists
What it means
In LogUtils.readPartFileContentFromLocal, if the given path does not exist or is not a regular file, the method immediately throws RuntimeException('The file path: <path> not exists'). This is a pre-check failure before any I/O is attempted, so no cause exception is attached.
Source
Thrown at dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/LogUtils.java:76
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) {
// If a single line of log is exceed max response size, cut off the line
final int lineByteSize = line.getBytes(StandardCharsets.UTF_8).length;
if (lineByteSize >= MaxResponseLogSize) {View on GitHub (pinned to 02eac45a1b)
Solutions
- Verify the file exists with Files.exists/Files.isRegularFile before calling, and return a friendly 'log expired' message to the user
- Check that the path points to the correct host — read logs through the remote variant (readPartFileContentFromRemote) on the worker that owns the file
- Reconstruct the path from the correct task instance/app id rather than a cached or stale value
- Extend log retention or archive logs before cleanup if they must remain viewable
- If the file may appear shortly (async writer), retry after a short delay
Example fix
// before
List<String> lines = LogUtils.readPartFileContentFromLocal(path, 0, 100);
// after
File f = new File(path);
if (!f.exists() || !f.isFile()) {
log.warn("Log file not found: {}", path);
return Collections.emptyList();
}
List<String> lines = LogUtils.readPartFileContentFromLocal(path, 0, 100); Defensive patterns
Strategy: validation
Validate before calling
boolean logFileAvailable(String path) {
File f = new File(path);
return f.exists() && f.isFile();
} Try / catch
try {
List<String> lines = LogUtils.readPartFileContentFromLocal(filePath, skip, limit);
} catch (RuntimeException e) {
if (e.getMessage() != null && e.getMessage().contains("not exists")) {
log.info("Log file already cleaned up: {}", filePath);
lines = Collections.emptyList();
} else { throw e; }
} Prevention
- Always check Files.exists/Files.isRegularFile before reading
- Query logs on the host that owns the file (use the remote variant) instead of local paths across nodes
- Configure log retention longer than the UI's log-view window
- Derive log paths from the current task instance metadata, not stale cached values
When it happens
Trigger: Calling readPartFileContentFromLocal(filePath, skipLine, limit) when new File(filePath).exists() is false or the path is a directory/symlink target that vanished — typically a log file that was deleted, rotated, or whose path was constructed incorrectly.
Common situations: Viewing logs of an old task instance after log cleanup/retention deleted the files; wrong master/worker host querying a log that lives on another machine; wrong task instance id producing a bad path; container restarts that lost ephemeral log volumes.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Create xlsx directory error
- Thr resource is not exists: ${resourceAbsolutePath}
- Read file: %s error
- Failed to create parent directory for destination file
- Error reading file: ${filePath}
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/20ee1701526247b1.
Report an issue: GitHub.