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

  1. Remove the extension-like suffix from the requested directory name (use 'backup-2024' not 'backup.2024').
  2. Send the parent directory in the correct request field and put the new folder name in directoryName.
  3. 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

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


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/62a64aff8558ac01. Report an issue: GitHub.