apache/dolphinscheduler · error · ServiceException

Invalidated resource path: ${resourceAbsolutePath}

Error message

Invalidated resource path: ${resourceAbsolutePath}

What it means

After the blank check, exceptionResourceAbsolutePathInvalidated verifies the path starts with storageOperator.getStorageBaseDirectory() (the configured storage root, e.g. the HDFS/S3 base dir). A path outside the configured storage base is rejected with ServiceException("Invalidated resource path: ..."). This prevents accessing resources outside DolphinScheduler-managed storage.

Source

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

    private static final Set<String> FILE_SUFFIXES_WHICH_CAN_FETCH_CONTENT = new HashSet<>(Arrays.asList(
            StringUtils.defaultIfBlank(FileUtils.getResourceViewSuffixes(), "").split(",")));

    protected final StorageOperator storageOperator;

    private final TenantDao tenantDao;

    public AbstractResourceValidator(StorageOperator storageOperator, TenantDao tenantDao) {
        this.storageOperator = storageOperator;
        this.tenantDao = tenantDao;
    }

    public void exceptionResourceAbsolutePathInvalidated(String resourceAbsolutePath) {
        if (StringUtils.isBlank(resourceAbsolutePath)) {
            throw new ServiceException("The resource path is null");
        }
        if (!resourceAbsolutePath.startsWith(storageOperator.getStorageBaseDirectory())) {
            throw new ServiceException("Invalidated resource path: " + resourceAbsolutePath);
        }
        if (resourceAbsolutePath.contains("..")) {
            throw new ServiceException("Invalidated resource path: " + resourceAbsolutePath);
        }
    }

    public void exceptionFileInvalidated(MultipartFile file) {
        if (file == null) {
            throw new ServiceException("The file is null");
        }
    }

    public void exceptionFileContentInvalidated(String fileContent) {
        if (StringUtils.isEmpty(fileContent)) {
            throw new ServiceException("The file content is null");
        }
    }

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Use the full path as returned by the resource-center listing API rather than constructing it manually.
  2. Align resource.storage.* configuration with the actual base directory of stored resources.
  3. Migrate/re-upload resources so their stored paths live under the current storage base directory.

Example fix

// before
path = "/tmp/local-upload/script.sql";           // outside storage base
// after
path = "/dolphinscheduler/alice/resources/script.sql"; // starts with storageOperator.getStorageBaseDirectory()
Defensive patterns

Strategy: validation

Validate before calling

// client-side pre-check
const baseDir = storageBaseDirectory; // from server config / listing API
if (!resourceAbsolutePath.startsWith(baseDir)) {
    throw new IllegalArgumentException("path must be under storage base dir " + baseDir);
}

Type guard

function isInsideStorageBase(path, baseDir) {
  return typeof path === 'string' && path.startsWith(baseDir.replace(/\/$/, '') + '/');
}

Try / catch

try {
    // resource operation
} catch (ServiceException e) {
    if (e.getMessage().startsWith("Invalidated resource path:")) {
        // reload paths via the resource listing API; verify storage config
    } else throw e;
}

Prevention

When it happens

Trigger: Requesting a resource whose absolute path is not under the configured storage base directory - typically when the storage base configuration changed (resource.storage.type/base dir) after resources were created, or a client passes an arbitrary local/absolute path.

Common situations: Cluster migration from local storage to HDFS/S3 without moving data; resource.storage.base.dir updated in config while old paths persist in the DB; manually crafted API calls referencing paths on a different tenant root or storage system.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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