{"record":{"id":"b4d5ff41381b5081","repo":"apache/dolphinscheduler","slug":"130008","errorCode":"130008","errorMessage":"create task group error","messagePattern":"create task group error","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"critical","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java","lineNumber":111,"sourceCode":"        if (duplicate != null) {\n            log.warn(\"Task group with the same name already exists, taskGroupName:{}.\", duplicate.getName());\n            throw new ServiceException(Status.TASK_GROUP_NAME_EXSIT);\n        }\n        Date now = new Date();\n        TaskGroup taskGroup = TaskGroup.builder()\n                .name(name)\n                .projectCode(projectCode)\n                .description(description)\n                .groupSize(groupSize)\n                .userId(loginUser.getId())\n                .status(Flag.YES)\n                .createTime(now)\n                .updateTime(now)\n                .build();\n\n        if (taskGroupMapper.insert(taskGroup) <= 0) {\n            log.error(\"Create task group error, taskGroupName:{}.\", taskGroup.getName());\n            throw new ServiceException(Status.CREATE_TASK_GROUP_ERROR);\n        }\n        log.info(\"Create task group complete, taskGroupName:{}.\", taskGroup.getName());\n        return taskGroup;\n    }\n\n    @Override\n    public TaskGroup updateTaskGroup(User loginUser, int id, String name, String description, int groupSize) {\n        TaskGroup taskGroup = taskGroupMapper.selectById(id);\n        requireProjectPerm(loginUser, taskGroup.getProjectCode(), true);\n        if (checkDescriptionLength(description)) {\n            log.warn(\"Parameter description is too long.\");\n            throw new ServiceException(Status.DESCRIPTION_TOO_LONG_ERROR);\n        }\n        if (name == null) {\n            log.warn(\"Parameter name can ot be null.\");\n            throw new ServiceException(Status.NAME_NULL);\n        }\n        if (groupSize <= 0) {","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java#L93-L129","documentation":"After passing all validations, createTaskGroup inserts the new TaskGroup; if taskGroupMapper.insert returns <= 0 (no row written), it throws Status.CREATE_TASK_GROUP_ERROR (code 130008). This indicates the insert unexpectedly failed at the persistence layer despite valid input.","triggerScenarios":"DB insert affecting zero rows during createTaskGroup — typically underlying database errors surfaced as 0 affected rows, a transaction rollback condition, or a misconfigured datasource.","commonSituations":"Database connectivity issues or constraint violations at insert time; schema drift between code and DB (missing t_ds_task_group columns); read-only replica used for writes.","solutions":["Check the API server logs around this error for the underlying SQL/DB exception.","Verify the t_ds_task_group table exists with the expected schema.","Confirm the datasource is writable and healthy; retry after restoring DB connectivity."],"exampleFix":"// before\n// ignoring DB health, blindly retrying create\ncreateTaskGroup(user, projectCode, name, desc, size);\n// after\ntry {\n    createTaskGroup(user, projectCode, name, desc, size);\n} catch (ServiceException e) {\n    if (e.getCode() == 130008) { checkDbHealthAndRetry(); }\n}","handlingStrategy":"retry","validationCode":"// pre-check DB connectivity if embedding the service:\n// try (SqlSession s = sqlSessionFactory.openSession()) { s.getConnection().isValid(3); }","typeGuard":null,"tryCatchPattern":"try { api.createTaskGroup(u, pc, name, desc, size); }\ncatch (ServiceException e) { if (e.getCode() == 130008) { logServerError(e); checkDbHealth(); retryWithBackoff(); } }","preventionTips":["Monitor database health and schema migrations for t_ds_task_group","Check server logs for the root SQL exception on 130008","Use bounded retries with backoff for transient DB failures"],"tags":["database","insert","task-group"],"backgroundTag":"database-write-failed","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}