apache/dolphinscheduler · error · ServiceException
RESOURCE_NOT_EXIST_OR_NO_PERMISSION
RESOURCE_NOT_EXIST_OR_NO_PERMISSION
Error message
User does not have permission to use datasource referenced by task, userId:{}. What it means
TaskDatasourcePermissionChecker.checkPermission throws ServiceException(RESOURCE_NOT_EXIST_OR_NO_PERMISSION) when the current user fails resourcePermissionCheck for the datasource IDs referenced by a task. Non-admins are checked against their own userId; the API rejects the task save/execution request.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/permission/TaskDatasourcePermissionChecker.java:82
Map<Integer, AbstractResourceParameters> datasourceResources =
resources.getResourceMap(ResourceType.DATASOURCE);
if (datasourceResources == null) {
continue;
}
datasourceResources.keySet().stream()
.filter(datasourceId -> datasourceId != null && datasourceId > 0)
.forEach(datasourceIds::add);
}
if (datasourceIds.isEmpty()) {
return;
}
int userId = loginUser.getUserType() == UserType.ADMIN_USER ? 0 : loginUser.getId();
Integer[] datasourceIdArray = datasourceIds.toArray(new Integer[0]);
if (!resourcePermissionCheckService.resourcePermissionCheck(
AuthorizationType.DATASOURCE, datasourceIdArray, userId, log)) {
log.warn("User does not have permission to use datasource referenced by task, userId:{}.",
loginUser.getId());
throw new ServiceException(Status.RESOURCE_NOT_EXIST_OR_NO_PERMISSION);
}
}
}
View on GitHub (pinned to 02eac45a1b)
Solutions
- Have an admin grant the user authorization for the referenced datasource (Datasource permission management / authorization page).
- Reassign the task to use a datasource the user already has permission on.
- Check that the datasource still exists — it may have been deleted, triggering the same no-permission status.
- If appropriate, perform the operation as an admin user (admins bypass the per-user check with userId 0).
Example fix
// before // user 'dev1' references datasource id=42 owned by admin, no grant POST /datasources/... task uses datasourceId=42 -> 429/RESOURCE_NOT_EXIST_OR_NO_PERMISSION // after // admin grants dev1 access to datasource 42 (UI: Security -> Datasource -> authorize) or dev1 picks own datasource id=43
Defensive patterns
Strategy: validation
Validate before calling
// before saving a task, verify user's datasource access
GET /api/dolphinscheduler/datasources/list?searchVal=
owned_ids = {ds['id'] for ds in response['data']}
assert datasource_ids <= owned_ids, f"no permission on: {datasource_ids - owned_ids}" Type guard
def has_datasource_permission(user_datasource_ids, required_ids):
return set(required_ids).issubset(set(user_datasource_ids)) Try / catch
try:
api.save_task(...)
except ApiException as e:
if 'RESOURCE_NOT_EXIST_OR_NO_PERMISSION' in str(e):
request_datasource_grant(); raise Prevention
- Grant datasource permissions to project members when creating shared workflows
- Verify datasource ownership after copying workflows between projects/users
- Re-check permissions after role downgrades
- Confirm referenced datasources still exist before saving tasks
When it happens
Trigger: A non-admin user saves or operates on a task whose datasourceIds include at least one datasource they have no DATASOURCE authorization for; resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.DATASOURCE, ...) returns false.
Common situations: Task inherited/copied from another user's workflow, datasource deleted or reassigned, user role downgraded, datasource created by admin without granting access to the project member, cross-project task references.
Understand the failure class
Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.
Related errors
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/d655a4e85177cc80.
Report an issue: GitHub.