apache/dolphinscheduler · error · ServiceException
The path is not a directory: ${resourceAbsolutePath}
Error message
The path is not a directory: ${resourceAbsolutePath} What it means
exceptionResourceIsNotDirectory throws this ServiceException when an operation requires a directory but the given resource path has a non-empty file extension, which the validator uses as a heuristic to decide the path points to a file rather than a directory.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/resource/AbstractResourceValidator.java:101
throw new ServiceException("The file type: " + fileExtension + " cannot be fetched");
}
}
public void exceptionResourceNotExists(String resourceAbsolutePath) {
if (!storageOperator.exists(resourceAbsolutePath)) {
throw new ServiceException("Thr resource is not exists: " + resourceAbsolutePath);
}
}
public void exceptionResourceExists(String resourceAbsolutePath) {
if (storageOperator.exists(resourceAbsolutePath)) {
throw new ServiceException("The resource is already exist: " + resourceAbsolutePath);
}
}
public void exceptionResourceIsNotDirectory(String resourceAbsolutePath) {
if (StringUtils.isNotEmpty(Files.getFileExtension(resourceAbsolutePath))) {
throw new ServiceException("The path is not a directory: " + resourceAbsolutePath);
}
}
public void exceptionResourceIsNotFile(String fileAbsolutePath) {
if (StringUtils.isEmpty(Files.getFileExtension(fileAbsolutePath))) {
throw new ServiceException("The path is not a file: " + fileAbsolutePath);
}
}
public void exceptionUserNoResourcePermission(User user, AbstractResourceDto resourceDto) {
exceptionUserNoResourcePermission(user, resourceDto.getResourceAbsolutePath());
}
public void exceptionUserNoResourcePermission(User user, String resourceAbsolutePath) {
if (user.getUserType() == UserType.ADMIN_USER) {
return;
}
// check if the user have resource tenant permissionView on GitHub (pinned to 02eac45a1b)
Solutions
- Pass the parent directory path (without a file extension) instead of the file path.
- If your directory name contains dots, rename it without a trailing extension-like suffix, as the validator treats any extension as a file.
- Verify the request payload field (e.g. currentDir vs fileName) is populated with the directory.
Example fix
// before: passing a file where a directory is required createDirectory(loginUser, "/tenant/resources/script.sh", "subdir"); // after createDirectory(loginUser, "/tenant/resources", "subdir");
Defensive patterns
Strategy: validation
Validate before calling
if (!org.apache.commons.io.FilenameUtils.getExtension(dirPath).isEmpty()) { throw new IllegalArgumentException("Expected a directory path: " + dirPath); } Type guard
boolean isDirectoryPath(String p) { return org.apache.commons.io.FilenameUtils.getExtension(p).isEmpty(); } Prevention
- Keep directory names free of dot-suffixed extensions.
- Bind UI directory pickers to directory-typed fields only.
- Pass parent directories, not files, wherever a directory parameter is expected.
When it happens
Trigger: Creating a subdirectory or listing a directory under a path like 'resources/data/notes.txt'; passing a file path where the API expects a parent directory.
Common situations: Copy-pasting a file path instead of its parent folder; front-end sending the selected file instead of the directory; directory names that contain dots (e.g. 'v1.2') falsely treated as files.
Related errors
- The path is not a file: ${fileAbsolutePath}
- The path is not a directory: ${directoryAbsolutePath}
- ILLEGAL_RESOURCE_PATH
- 20016
- ILLEGAL_RESOURCE_PATH
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/4e0407e6eda8ea29.
Report an issue: GitHub.