apache/dolphinscheduler · error · ServiceException
The path is not a directory: ${directoryAbsolutePath}
Error message
The path is not a directory: ${directoryAbsolutePath} What it means
CreateDirectoryDtoValidator.validate throws this ServiceException when the directory path requested for creation carries a non-empty file extension, so the validator concludes it names a file, not a directory. This duplicates the exceptionResourceIsNotDirectory check immediately above it in the same method.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/resource/CreateDirectoryDtoValidator.java:47
import com.google.common.io.Files;
@Component
public class CreateDirectoryDtoValidator extends AbstractResourceValidator<CreateDirectoryDto> {
public CreateDirectoryDtoValidator(StorageOperator storageOperator, TenantDao tenantDao) {
super(storageOperator, tenantDao);
}
@Override
public void validate(CreateDirectoryDto createDirectoryDto) {
String directoryAbsolutePath = createDirectoryDto.getDirectoryAbsolutePath();
exceptionResourceAbsolutePathInvalidated(directoryAbsolutePath);
exceptionResourceExists(directoryAbsolutePath);
exceptionUserNoResourcePermission(createDirectoryDto.getLoginUser(), directoryAbsolutePath);
exceptionResourceIsNotDirectory(directoryAbsolutePath);
if (StringUtils.isNotEmpty(Files.getFileExtension(directoryAbsolutePath))) {
throw new ServiceException("The path is not a directory: " + directoryAbsolutePath);
}
}
}
View on GitHub (pinned to 02eac45a1b)
Solutions
- Remove the extension-like suffix from the requested directory name (use 'backup-2024' not 'backup.2024').
- Send the parent directory in the correct request field and put the new folder name in directoryName.
- If you actually want a file, use the create-file API instead.
Example fix
// before createDirectory(loginUser, "/tenant/resources/archive.old"); // after createDirectory(loginUser, "/tenant/resources/archive-old");
Defensive patterns
Strategy: validation
Validate before calling
if (!org.apache.commons.io.FilenameUtils.getExtension(newDirPath).isEmpty()) { throw new IllegalArgumentException("Directory name must not have an extension: " + newDirPath); } Type guard
boolean isValidNewDirectoryName(String p) { return org.apache.commons.io.FilenameUtils.getExtension(p).isEmpty(); } Prevention
- Avoid dots in new directory names (use dashes instead).
- Send the new folder name in directoryName and the existing parent in the parent field.
- Use create-file APIs for paths that intentionally have extensions.
When it happens
Trigger: Calling the create-directory API with a path like '/tenant/resources/data.txt' (any dot-suffixed last segment); the check runs after existence and permission checks pass.
Common situations: Users typing a directory name containing a dot (e.g. 'backup.2024'); front-end passing the wrong field (fileName instead of directory path); copy-paste of a file path as the target directory.
Related errors
- The path is not a directory: ${resourceAbsolutePath}
- skipLineNum must be greater than or equal to 0
- limit must be -1 or greater than 0
- DESCRIPTION_TOO_LONG_ERROR
- ENVIRONMENT_NAME_IS_NULL
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/62a64aff8558ac01.
Report an issue: GitHub.