{"record":{"id":"c1cbe30ab2c26a6d","repo":"apache/dolphinscheduler","slug":"task-group-size-error","errorCode":"TASK_GROUP_SIZE_ERROR","errorMessage":"Parameter task group size is must bigger than 1.","messagePattern":"Parameter task group size is must bigger than 1\\.","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java","lineNumber":89,"sourceCode":"    private TaskGroupQueueService taskGroupQueueService;\n\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();","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java#L71-L107","documentation":"createTaskGroup requires groupSize to be strictly positive; when groupSize <= 0 it throws ServiceException(Status.TASK_GROUP_SIZE_ERROR) with the message 'must bigger than 1'. groupSize determines how many tasks the group can hold, so a non-positive value is rejected before the duplicate-name check.","triggerScenarios":"Calling the task-group create API with groupSize=0, a negative number, or a value that binds to 0 (e.g. empty input coerced to int 0).","commonSituations":"UI number inputs left at default 0; scripts computing capacity as `used - free` yielding 0; int parsing of an empty string producing 0.","solutions":["Pass a groupSize of at least 1 (practically the intended capacity, e.g. 10).","Default the input field to a sensible positive value instead of 0.","Clamp or reject non-positive values in the client before calling the API.","Verify the parameter key actually reaches the server (a missing int parameter binds to 0 in some binding paths)."],"exampleFix":"// before\nawait createTaskGroup({ name: 'etl-group', groupSize: 0 })\n// after\nconst groupSize = Number(input.value)\nawait createTaskGroup({ name: 'etl-group', groupSize: Math.max(1, groupSize) })","handlingStrategy":"validation","validationCode":"function isGroupSizeValid(size: unknown): size is number {\n  return typeof size === 'number' && Number.isInteger(size) && size > 0\n}\nconst groupSize = Number(rawInput)\nif (!isGroupSizeValid(groupSize)) throw new Error('groupSize must be a positive integer')","typeGuard":"function isPositiveInt(v: unknown): v is number {\n  return typeof v === 'number' && Number.isInteger(v) && v > 0\n}","tryCatchPattern":"try {\n  await createTaskGroup({ name, groupSize })\n} catch (e) {\n  if (isServiceException(e, 'TASK_GROUP_SIZE_ERROR')) {\n    formErrors.groupSize = 'Capacity must be at least 1'\n  } else throw e\n}","preventionTips":["Use number inputs with min=1 so browsers block 0/negatives.","Coerce form strings with Number() and validate before sending (empty string coerces to 0).","Default capacity fields to a realistic positive value (e.g. 10)."],"tags":["parameter-validation","numeric","api"],"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"}