apache/dolphinscheduler · error · ServiceException

The resource path is null

Error message

The resource path is null

What it means

AbstractResourceValidator.exceptionResourceAbsolutePathInvalidated first rejects a blank (null or empty/whitespace) resource absolute path with ServiceException("The resource path is null"). It is the first guard in validating that resource paths used by resource-center APIs are present before checking prefix and traversal characters.

Source

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

import com.google.common.io.Files;

public abstract class AbstractResourceValidator<T> implements IValidator<T> {

    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. Provide the full resource absolute path (or valid resource id/full name) in the request.
  2. Verify the target resource exists in the resource center and has a non-empty path.
  3. In client code, check StringUtils.isNotBlank(path) before calling the API.

Example fix

// before
validator.exceptionResourceAbsolutePathInvalidated("");
// after
validator.exceptionResourceAbsolutePathInvalidated("/alice/resources/script.sql");
Defensive patterns

Strategy: validation

Validate before calling

// client-side pre-check
if (resourceAbsolutePath == null || resourceAbsolutePath.trim().isEmpty()) {
    throw new IllegalArgumentException("resourceAbsolutePath must be a non-empty path");
}

Type guard

function hasResourcePath(r) {
  return typeof r.resourceAbsolutePath === 'string' && r.resourceAbsolutePath.trim().length > 0;
}

Try / catch

try {
    // download / view / update resource
} catch (ServiceException e) {
    if (e.getMessage().contains("The resource path is null")) {
        // re-resolve the resource full name from the listing API
    } else throw e;
}

Prevention

When it happens

Trigger: Any resource API call (download, view content, update, delete) whose resourceAbsolutePath parameter resolves to null or an empty string, e.g. a resource name/id that maps to no stored path.

Common situations: Client omits the resource path parameter; a DB row has an empty file path column; frontend sends blank alias/name fields; copying a resource that never had a file uploaded.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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