apache/dolphinscheduler · error · IllegalArgumentException
Failed to parse Condition task params: {taskParams}
Error message
Failed to parse Condition task params: {taskParams} What it means
Thrown by replaceTaskCodeForConditionTaskParams when the Condition task's taskParams JSON cannot be deserialized into ConditionsParameters (JSONUtils.parseObject threw). The raw params string is included in the message. Occurs while remapping dependency task codes during workflow copy/import; the operation aborts because Condition branches cannot be remapped from an unreadable params document.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java:1503
}
}
taskDefLog.setTaskParams(JSONUtils.toJsonString(params));
}
/**
* Replaces old task codes with new ones in the parameters of a Condition task.
* Used during workflow duplication or import to preserve correct task dependencies.
*/
private void replaceTaskCodeForConditionTaskParams(TaskDefinitionLog taskDefLog, Map<Long, Long> taskCodeMap) {
String taskParams = taskDefLog.getTaskParams();
ConditionsParameters params;
try {
params = JSONUtils.parseObject(taskParams, ConditionsParameters.class);
} catch (Exception e) {
log.warn("Invalid Condition task params: {}", taskParams, e);
throw new IllegalArgumentException("Failed to parse Condition task params: " + taskParams, e);
}
if (params == null) {
log.warn("Parsed Condition task params is null: {}", taskParams);
throw new IllegalArgumentException("Failed to parse Condition task params: " + taskParams);
}
// Update dependency task codes
ConditionsParameters.ConditionDependency dep = params.getDependence();
if (dep != null) {
for (ConditionDependentTaskModel taskModel : dep.getDependTaskList()) {
for (ConditionDependentItem item : taskModel.getDependItemList()) {
Long oldCode = item.getDepTaskCode();
if (taskCodeMap.containsKey(oldCode)) {
item.setDepTaskCode(taskCodeMap.get(oldCode));
}
}
}View on GitHub (pinned to 02eac45a1b)
Solutions
- Inspect the malformed taskParams echoed in the error and fix the JSON structure (dependence, conditionResult with successNode/failedNode).
- Open the Condition task in the UI and re-save its parameters to regenerate valid JSON.
- Re-export from a source system running the same DolphinScheduler version, then re-import.
- Validate the import file's task_params for all CONDITION task types before importing.
Example fix
// before (taskParams)
{"dependence": {"dependTaskList": [{"dependItemList": 42}]}}
// after
{"dependence": {"dependTaskList": [{"dependItemList": [{"depTaskCode": 111, "depTaskVersion": 1}]}]}, "conditionResult": {"successNode": [222], "failedNode": [333]}} Defensive patterns
Strategy: validation
Validate before calling
boolean validConditionParams(String taskParams) {
if (taskParams == null || taskParams.trim().isEmpty()) return false;
try {
return JSONUtils.parseObject(taskParams, ConditionsParameters.class) != null;
} catch (Exception e) { return false; }
}
// call for every CONDITIONS task before copy/import Type guard
boolean isParsedConditionParams(String raw) {
try { return JSONUtils.parseObject(raw, ConditionsParameters.class) != null; }
catch (Exception e) { return false; }
} Try / catch
try {
workflowDefinitionService.batchCopyWorkflowDefinition(...);
} catch (ServiceException | IllegalArgumentException e) {
log.error("Copy failed, check Condition taskParams JSON", e);
} Prevention
- Re-export condition workflows when migrating between DolphinScheduler versions.
- Validate dependTaskList/conditionResult structure in import files before importing.
- Fix malformed task_params in the UI (re-save the Condition task) rather than patching JSON by hand.
When it happens
Trigger: Copying/importing a workflow whose Condition task has malformed taskParams — invalid JSON, wrong types for dependence/conditionResult fields, or unexpected structure in dependTaskList.
Common situations: Definitions exported from older DolphinScheduler versions whose ConditionsParameters shape differs; hand-edited import JSON; direct DB edits to task_params.
Understand the failure class
Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Failed to parse Switch task params: {taskParams}
- Condition task params: ${taskParams} is invalid.
- ${e.getMessage()}
- Sagemaker task params is empty
- Sqoop Task params is null
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/c71696a08de91f26.
Report an issue: GitHub.