apache/dolphinscheduler · warning · ServiceException
REQUEST_PARAMS_NOT_VALID_ERROR
REQUEST_PARAMS_NOT_VALID_ERROR
Error message
REQUEST_PARAMS_NOT_VALID_ERROR: request parameter {0} is not valid What it means
Thrown by viewTree when the requested 'limit' (number of workflow instances to render in the tree) is negative. Only non-negative limits are accepted; the limit is clamped to the instance count afterwards.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java:1141
// nodes that are running
Map<Long, List<TreeViewDto>> runningNodeMap = new ConcurrentHashMap<>();
// nodes that are waiting to run
Map<Long, List<TreeViewDto>> waitingRunningNodeMap = new ConcurrentHashMap<>();
// List of workflow instances
List<WorkflowInstanceSummaryDto> workflowInstanceList =
workflowInstanceService.queryByWorkflowDefinitionCode(code, limit);
workflowInstanceList.forEach(workflowInstance -> workflowInstance
.setDuration(
DateUtils.format2Duration(workflowInstance.getStartTime(), workflowInstance.getEndTime())));
List<TaskDefinitionLog> taskDefinitionList = taskDefinitionLogDao.queryByWorkflowDefinitionCodeAndVersion(
workflowDefinition.getCode(), workflowDefinition.getVersion());
Map<Long, TaskDefinitionLog> taskDefinitionMap = taskDefinitionList.stream()
.collect(Collectors.toMap(TaskDefinitionLog::getCode, taskDefinitionLog -> taskDefinitionLog));
if (limit < 0) {
throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR);
}
if (limit > workflowInstanceList.size()) {
limit = workflowInstanceList.size();
}
TreeViewDto parentTreeViewDto = new TreeViewDto();
parentTreeViewDto.setName("DAG");
parentTreeViewDto.setType("");
parentTreeViewDto.setCode(0L);
// Specify the workflow definition, because it is a TreeView for a workflow definition
for (int i = limit - 1; i >= 0; i--) {
WorkflowInstanceSummaryDto workflowInstance = workflowInstanceList.get(i);
Date endTime = workflowInstance.getEndTime() == null ? new Date() : workflowInstance.getEndTime();
parentTreeViewDto.getInstances()
.add(new Instance(workflowInstance.getId(), workflowInstance.getName(),
workflowInstance.getWorkflowDefinitionCode(),
"", workflowInstance.getState().name(), workflowInstance.getStartTime(), endTime,
workflowInstance.getHost(),View on GitHub (pinned to 02eac45a1b)
Solutions
- Pass a non-negative limit (e.g. limit >= 0); use a positive number to cap rendered instances.
- Clamp the limit client-side: limit = Math.max(0, limit) before calling the API.
- Omit or set a sensible default (e.g. 10) instead of a sentinel negative value.
- If a UI/plugin computes the limit, fix its formula so it cannot go negative.
Example fix
// before GET .../view-tree?limit=-1 // after GET .../view-tree?limit=10
Defensive patterns
Strategy: validation
Validate before calling
if (limit < 0) throw new IllegalArgumentException("limit must be >= 0");
String url = base + "/view-tree?limit=" + Math.max(0, limit); Try / catch
try {
tree = client.viewTree(projectCode, code, limit);
} catch (ServiceException e) {
if (e.getCode() == Status.REQUEST_PARAMS_NOT_VALID_ERROR.getCode()) {
tree = client.viewTree(projectCode, code, Math.max(0, limit));
} else throw e;
} Prevention
- Clamp/sanitize the limit query parameter before building the request
- Use a positive default (e.g. 10) instead of negative sentinels for 'all'
- Test URL-building code paths for sign errors
When it happens
Trigger: GET .../view-tree?limit=-1 (or any negative value) — the query parameter is parsed as an int and fails the limit < 0 check.
Common situations: Client-side code computing limit from a delta that went negative; copy-paste of a URL with a negative query param; UI bug sending -1 as 'unlimited'; automated scripts iterating limits incorrectly.
Understand the failure class
Background: "Invalid query parameter" / "Failed to parse value of ...": fixing bad query string parameters across APIs — this error's family across 36 libraries.
Related errors
- NEGTIVE_SIZE_NUMBER_ERROR
- url can not be null
- 10001
- namespace %s does not exist in k8s cluster, please create na
- ID token is missing required claims
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/131a44ce04b23fe3.
Report an issue: GitHub.