{"record":{"id":"a36da91535d84d84","repo":"apache/dolphinscheduler","slug":"130002","errorCode":"130002","errorMessage":"task group size error","messagePattern":"task group size error","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java","lineNumber":90,"sourceCode":"\n    @Autowired\n    private ExecutorService executorService;\n\n    @Override\n    @Transactional\n    public TaskGroup createTaskGroup(User loginUser, Long projectCode, String name, String description, int groupSize) {\n        requireProjectPerm(loginUser, projectCode, 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) {\n            log.warn(\"Parameter task group size is must bigger than 1.\");\n            throw new ServiceException(Status.TASK_GROUP_SIZE_ERROR);\n        }\n        TaskGroup duplicate = taskGroupMapper.queryByName(loginUser.getId(), name);\n        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","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java#L72-L108","documentation":"createTaskGroup validates that groupSize is a positive integer; groupSize <= 0 fails with Status.TASK_GROUP_SIZE_ERROR (code 130002). The size defines how many task instances the group can hold concurrently, so a non-positive value is meaningless.","triggerScenarios":"POST /task-group/update-or-create with groupSize = 0, negative, or an unparseable/absent int that binds to 0.","commonSituations":"UI defaults of 0 sent unchanged; config scripts computing size from a value that evaluates to 0; int overflow or type confusion when passing sizes from other systems.","solutions":["Pass a groupSize >= 1 (and sensibly small, e.g. within resource limits).","Add client-side validation that groupSize is a positive integer.","Fix upstream calculation that yields 0/negative sizes."],"exampleFix":"// before\nint size = config.getSize(); // may be 0\ncreateTaskGroup(user, projectCode, name, desc, size);\n// after\nint size = Math.max(1, config.getSize());\ncreateTaskGroup(user, projectCode, name, desc, size);","handlingStrategy":"validation","validationCode":"if (groupSize <= 0) {\n    throw new IllegalArgumentException(\"task group size must be >= 1\");\n}","typeGuard":null,"tryCatchPattern":"try { api.createTaskGroup(u, pc, name, desc, size); }\ncatch (ServiceException e) { if (e.getCode() == 130002) { size = Math.max(1, size); retry(); } }","preventionTips":["Use min=1 on size inputs in UIs and forms","Never use size=0 to disable groups; use the status/close API","Sanitize unbind/missing integers that default to 0"],"tags":["validation","task-group","out-of-range"],"backgroundTag":"value-out-of-range","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"}