apache/dolphinscheduler · error · ServiceException

The path is not a file: ${fileAbsolutePath}

Error message

The path is not a file: ${fileAbsolutePath}

What it means

exceptionResourceIsNotFile throws this ServiceException when an operation requires a file but the given path has an empty extension, which the validator uses as a heuristic that the path refers to a directory rather than a file.

Source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/resource/AbstractResourceValidator.java:107

            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 permission
        // Parse the resource path to get the tenant code
        ResourceMetadata resourceMetaData = storageOperator.getResourceMetaData(resourceAbsolutePath);

        if (!resourceAbsolutePath.startsWith(resourceMetaData.getResourceBaseDirectory())) {
            throw new ServiceException("Invalidated resource path: " + resourceAbsolutePath);
        }

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Pass the full file path including its extension (e.g. '/tenant/resources/job.sql').
  2. Rename extensionless files to include an extension so the validator can distinguish them from directories.
  3. Confirm the client sends the file path, not its containing directory.

Example fix

// before
fetchFileContent(loginUser, "/tenant/resources/scripts", 0, -1);
// after
fetchFileContent(loginUser, "/tenant/resources/scripts/job.sh", 0, -1);
Defensive patterns

Strategy: validation

Validate before calling

if (org.apache.commons.io.FilenameUtils.getExtension(filePath).isEmpty()) { throw new IllegalArgumentException("Expected a file path with extension: " + filePath); }

Type guard

boolean isFilePath(String p) { return !org.apache.commons.io.FilenameUtils.getExtension(p).isEmpty(); }

Prevention

When it happens

Trigger: Reading/editing/downloading file content at a path with no extension (e.g. '/tenant/resources/mydir'), or passing a directory path to a file-only API.

Common situations: Selecting a folder in the UI instead of a file; extensionless file names misclassified as directories; path truncated during copy-paste losing the '.sh'/'.py' suffix.

Related errors


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