{"record":{"id":"23631ccc0978cd88","repo":"apache/dolphinscheduler","slug":"can-not-find-valid-resource-by-name-s","errorCode":null,"errorMessage":"Can not find valid resource by name %s","messagePattern":"Can not find valid resource by name (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java","lineNumber":598,"sourceCode":"\n    /**\n     * Get resource by given program type and full name. It returns map contain resource id, name.\n     * Useful in Python API create flink or spark task which need workflow information.\n     *\n     * @param fullName    full name of the resource\n     */\n    public Map<String, Object> getResourcesFileInfo(String fullName) {\n        Map<String, Object> result = new HashMap<>();\n\n        List<ResourceComponent> resourceComponents =\n                resourceService.queryResourceFiles(dummyAdminUser, ResourceType.FILE);\n        List<ResourceComponent> namedResources = resourceComponents.stream()\n                .filter(s -> fullName.equals(s.getFullName()))\n                .collect(Collectors.toList());\n        if (CollectionUtils.isEmpty(namedResources)) {\n            String msg = String.format(\"Can not find valid resource by name %s\", fullName);\n            log.error(msg);\n            throw new IllegalArgumentException(msg);\n        }\n\n        result.put(\"name\", namedResources.get(0).getName());\n        return result;\n    }\n\n    /**\n     * Get environment info by given environment name. It return environment code.\n     * Useful in Python API create task which need environment information.\n     *\n     * @param environmentName name of the environment\n     */\n    public Long getEnvironmentInfo(String environmentName) {\n        try {\n            return environmentService.queryEnvironmentByName(environmentName).getCode();\n        } catch (ServiceException e) {\n            String msg = String.format(\"Can not find valid environment by name %s\", environmentName);\n            log.error(msg);","sourceCodeStart":580,"sourceCodeEnd":616,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java#L580-L616","documentation":"getResourcesFileInfo filters loaded resource components by their fullName; when no resource's full name equals the requested name, it throws IllegalArgumentException. Full name in DolphinScheduler is typically the path-like identifier of the resource in the resource center.","triggerScenarios":"Calling getResourcesFileInfo for a resource whose fullName (e.g. directory path + filename) does not match any resource in the resource center.","commonSituations":"Python task referencing a file/script that was uploaded with a different path; resource deleted; leading/trailing slash or missing directory prefix in the full name; resource center storage migrated (HDFS/S3) and contents out of sync.","solutions":["Check the resource's full path in the Resource center and use it exactly (including directory prefix, e.g. /scripts/job.py)","Upload the missing resource before running the Python script","Normalize the fullName (leading slash, no double slashes) to match storage convention","Re-sync resource storage backend if the resource exists in the UI but not the underlying store"],"exampleFix":"// before (Python)\ntask = Shell(..., resource_list=[\"job.sh\"])\n// after\ntask = Shell(..., resource_list=[\"/scripts/job.sh\"])  # full path as in resource center","handlingStrategy":"validation","validationCode":"String fullName = \"/scripts/job.sh\";\nboolean exists = resourceCenter.listAllResources().stream()\n    .anyMatch(r -> fullName.equals(r.getFullName()));\nif (!exists) {\n    throw new IllegalStateException(\"Resource not found: \" + fullName);\n}","typeGuard":null,"tryCatchPattern":"try {\n    pythonGateway.getResourcesFileInfo(fullName);\n} catch (IllegalArgumentException e) {\n    log.error(\"Resource missing: {}\", e.getMessage());\n}","preventionTips":["Use the exact full path shown in the Resource center","Upload all referenced resources before executing Python workflows","Follow a single convention for resource paths (e.g. always leading slash)"],"tags":["python-api","resource","not-found"],"backgroundTag":"file-not-found","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"}