apache/dolphinscheduler · error · ServiceException
TASK_GROUP_SIZE_ERROR
TASK_GROUP_SIZE_ERROR
Error message
Parameter task group size is must bigger than 1.
What it means
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.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java:89
private TaskGroupQueueService taskGroupQueueService;
@Autowired
private ExecutorService executorService;
@Override
@Transactional
public TaskGroup createTaskGroup(User loginUser, Long projectCode, String name, String description, int groupSize) {
requireProjectPerm(loginUser, projectCode, true);
if (checkDescriptionLength(description)) {
log.warn("Parameter description is too long.");
throw new ServiceException(Status.DESCRIPTION_TOO_LONG_ERROR);
}
if (name == null) {
log.warn("Parameter name can ot be null.");
throw new ServiceException(Status.NAME_NULL);
}
if (groupSize <= 0) {
log.warn("Parameter task group size is must bigger than 1.");
throw new ServiceException(Status.TASK_GROUP_SIZE_ERROR);
}
TaskGroup duplicate = taskGroupMapper.queryByName(loginUser.getId(), name);
if (duplicate != null) {
log.warn("Task group with the same name already exists, taskGroupName:{}.", duplicate.getName());
throw new ServiceException(Status.TASK_GROUP_NAME_EXSIT);
}
Date now = new Date();
TaskGroup taskGroup = TaskGroup.builder()
.name(name)
.projectCode(projectCode)
.description(description)
.groupSize(groupSize)
.userId(loginUser.getId())
.status(Flag.YES)
.createTime(now)
.updateTime(now)
.build();View on GitHub (pinned to 02eac45a1b)
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).
Example fix
// before
await createTaskGroup({ name: 'etl-group', groupSize: 0 })
// after
const groupSize = Number(input.value)
await createTaskGroup({ name: 'etl-group', groupSize: Math.max(1, groupSize) }) Defensive patterns
Strategy: validation
Validate before calling
function isGroupSizeValid(size: unknown): size is number {
return typeof size === 'number' && Number.isInteger(size) && size > 0
}
const groupSize = Number(rawInput)
if (!isGroupSizeValid(groupSize)) throw new Error('groupSize must be a positive integer') Type guard
function isPositiveInt(v: unknown): v is number {
return typeof v === 'number' && Number.isInteger(v) && v > 0
} Try / catch
try {
await createTaskGroup({ name, groupSize })
} catch (e) {
if (isServiceException(e, 'TASK_GROUP_SIZE_ERROR')) {
formErrors.groupSize = 'Capacity must be at least 1'
} else throw e
} Prevention
- 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).
When it happens
Trigger: 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).
Common situations: UI number inputs left at default 0; scripts computing capacity as `used - free` yielding 0; int parsing of an empty string producing 0.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- DATA_IS_NOT_VALID
- REQUEST_PARAMS_NOT_VALID_ERROR
- DESCRIPTION_TOO_LONG_ERROR
- NAME_NULL
- USER_NO_OPERATION_PERM
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/c1cbe30ab2c26a6d.
Report an issue: GitHub.