{"record":{"id":"482976388e58f34d","repo":"apache/dolphinscheduler","slug":"10018","errorCode":"10018","errorMessage":"project {projectCode} not found ","messagePattern":"project (.+?) not found ","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java","lineNumber":283,"sourceCode":"        List<TaskGroup> taskGroups = taskGroupMapper.selectByProjectCode(projectCode);\n        if (CollectionUtils.isEmpty(taskGroups)) {\n            return;\n        }\n        List<Integer> taskGroupIds = taskGroups.stream()\n                .map(TaskGroup::getId)\n                .collect(Collectors.toList());\n        taskGroupQueueService.deleteByTaskGroupIds(taskGroupIds);\n        taskGroupMapper.deleteBatchIds(taskGroupIds);\n    }\n\n    private void requireProjectPerm(User loginUser, long projectCode, boolean writePermission) {\n        if (loginUser.getUserType() == UserType.ADMIN_USER) {\n            return;\n        }\n        Project project = projectDao.queryByCode(projectCode);\n        if (project == null) {\n            log.warn(\"Project does not exist, projectCode:{}.\", projectCode);\n            throw new ServiceException(Status.PROJECT_NOT_FOUND, projectCode);\n        }\n        if (project.getUserId().equals(loginUser.getId())) {\n            return;\n        }\n        ProjectUser projectUser = projectUserDao.queryProjectRelation(project.getId(), loginUser.getId());\n        if (projectUser == null) {\n            log.warn(\"User {} does not have operation permission for project {}\", loginUser.getUserName(),\n                    project.getCode());\n            throw new ServiceException(Status.USER_NO_OPERATION_PROJECT_PERM, loginUser.getUserName(),\n                    project.getCode());\n        }\n        if (writePermission && projectUser.getPerm() != Constants.DEFAULT_ADMIN_PERMISSION) {\n            log.warn(\"User {} does not have write permission for project {}\", loginUser.getUserName(),\n                    project.getCode());\n            throw new ServiceException(Status.USER_NO_WRITE_PROJECT_PERM, loginUser.getUserName(),\n                    project.getCode());\n        }\n    }","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java#L265-L301","documentation":"Thrown by the private requireProjectPerm helper when projectDao.queryByCode(projectCode) returns null. Task group operations (create/update/list by project) are scoped to a project, and no project exists with the given code for non-admin callers. Reported as Status.PROJECT_NOT_FOUND (code 10018) with the projectCode substituted into the message.","triggerScenarios":"Calling createTaskGroup, updateTaskGroup, or queryTaskGroupByProjectCode with a projectCode that does not exist in t_ds_project; passing a project name instead of its code; using a code from a different environment's database.","commonSituations":"Hardcoded project codes from another install; project deleted while UI held the old code; confusing project code (long numeric) with project id; cross-environment API scripts.","solutions":["Look up the correct project code via GET /project/list (or the UI URL of the project).","Confirm the project exists: SELECT * FROM t_ds_project WHERE code=<code>.","Create the project first if it genuinely does not exist.","Fix scripts that pass project name/id where the numeric project code is required.","Use an admin account only to bypass the permission check, not the existence check — the lookup still fails if the code is wrong."],"exampleFix":"// before\nString projectCode = \"data-pipeline\"; // name, not code\ntaskGroupService.createTaskGroup(loginUser, name, desc, total, projectCode);\n// after\nProject project = projectDao.queryByCode(actualNumericCode);\nif (project == null) {\n    throw new IllegalArgumentException(\"project not found for code \" + actualNumericCode);\n}\ntaskGroupService.createTaskGroup(loginUser, name, desc, total, actualNumericCode);","handlingStrategy":"validation","validationCode":"// Java: resolve and verify the project code before task group calls\nProject project = projectDao.queryByCode(projectCode);\nif (project == null) {\n    throw new ServiceException(Status.PROJECT_NOT_FOUND, projectCode);\n}","typeGuard":"boolean projectExists(long projectCode) {\n    return projectDao.queryByCode(projectCode) != null;\n}","tryCatchPattern":"try {\n    taskGroupService.createTaskGroup(loginUser, name, desc, total, projectCode);\n} catch (ServiceException e) {\n    if (e.getCode() == 10018) {\n        // refresh the project list; the code is stale or wrong\n    }\n    throw e;\n}","preventionTips":["Always pass the numeric project code, never the project name or id.","Resolve codes dynamically from GET /project/list instead of hardcoding.","Check for project deletion before reusing stored codes.","Use environment-specific config for project codes when running in multiple installs."],"tags":["project","not-found","task-group"],"backgroundTag":"resource-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"}