{"record":{"id":"d87e5e29fce3fb36","repo":"apache/dolphinscheduler","slug":"the-path-is-not-a-file-fileabsolutepath","errorCode":null,"errorMessage":"The path is not a file: ${fileAbsolutePath}","messagePattern":"The path is not a file: (.+?)","errorType":"validation","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/resource/AbstractResourceValidator.java","lineNumber":107,"sourceCode":"            throw new ServiceException(\"Thr resource is not exists: \" + resourceAbsolutePath);\n        }\n    }\n\n    public void exceptionResourceExists(String resourceAbsolutePath) {\n        if (storageOperator.exists(resourceAbsolutePath)) {\n            throw new ServiceException(\"The resource is already exist: \" + resourceAbsolutePath);\n        }\n    }\n\n    public void exceptionResourceIsNotDirectory(String resourceAbsolutePath) {\n        if (StringUtils.isNotEmpty(Files.getFileExtension(resourceAbsolutePath))) {\n            throw new ServiceException(\"The path is not a directory: \" + resourceAbsolutePath);\n        }\n    }\n\n    public void exceptionResourceIsNotFile(String fileAbsolutePath) {\n        if (StringUtils.isEmpty(Files.getFileExtension(fileAbsolutePath))) {\n            throw new ServiceException(\"The path is not a file: \" + fileAbsolutePath);\n        }\n    }\n\n    public void exceptionUserNoResourcePermission(User user, AbstractResourceDto resourceDto) {\n        exceptionUserNoResourcePermission(user, resourceDto.getResourceAbsolutePath());\n    }\n\n    public void exceptionUserNoResourcePermission(User user, String resourceAbsolutePath) {\n        if (user.getUserType() == UserType.ADMIN_USER) {\n            return;\n        }\n        // check if the user have resource tenant permission\n        // Parse the resource path to get the tenant code\n        ResourceMetadata resourceMetaData = storageOperator.getResourceMetaData(resourceAbsolutePath);\n\n        if (!resourceAbsolutePath.startsWith(resourceMetaData.getResourceBaseDirectory())) {\n            throw new ServiceException(\"Invalidated resource path: \" + resourceAbsolutePath);\n        }","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/resource/AbstractResourceValidator.java#L89-L125","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Pass the full file path including its extension (e.g. '/tenant/resources/job.sql').","Rename extensionless files to include an extension so the validator can distinguish them from directories.","Confirm the client sends the file path, not its containing directory."],"exampleFix":"// before\nfetchFileContent(loginUser, \"/tenant/resources/scripts\", 0, -1);\n// after\nfetchFileContent(loginUser, \"/tenant/resources/scripts/job.sh\", 0, -1);","handlingStrategy":"validation","validationCode":"if (org.apache.commons.io.FilenameUtils.getExtension(filePath).isEmpty()) { throw new IllegalArgumentException(\"Expected a file path with extension: \" + filePath); }","typeGuard":"boolean isFilePath(String p) { return !org.apache.commons.io.FilenameUtils.getExtension(p).isEmpty(); }","tryCatchPattern":null,"preventionTips":["Always include the file extension in resource file paths.","Rename extensionless files; the validator treats them as directories.","Select files (not folders) in file-content and download operations."],"tags":["resource","file","path-validation","dolphinscheduler"],"backgroundTag":"path-is-not-a-directory","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}