{"record":{"id":"5eb4895dfa245778","repo":"apache/dolphinscheduler","slug":"50017-5eb489","errorCode":"50017","errorMessage":"data {0} not valid","messagePattern":"data (.+?) not valid","errorType":"validation","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java","lineNumber":363,"sourceCode":"                    workflowTaskLineage.setTaskDefinitionVersion(taskDefinitionLog.getVersion());\n                    workflowTaskLineage.setDeptProjectCode(taskDefinitionLog.getProjectCode());\n                    workflowTaskLineage.setDeptWorkflowDefinitionCode(dependentItem.getDefinitionCode());\n                    workflowTaskLineage.setDeptTaskDefinitionCode(dependentItem.getDepTaskCode());\n                    workflowTaskLineageList.add(workflowTaskLineage);\n                }\n            }\n        }\n        return workflowTaskLineageList;\n    }\n\n    private List<TaskDefinitionLog> generateTaskDefinitionList(String taskDefinitionJson) {\n        try {\n            List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);\n\n            if (CollectionUtils.isEmpty(taskDefinitionLogs)) {\n                log.error(\"Generate task definition list failed, the given taskDefinitionJson is invalided: {}\",\n                        taskDefinitionJson);\n                throw new ServiceException(Status.DATA_IS_NOT_VALID, taskDefinitionJson);\n            }\n\n            Set<String> taskNameSet = new HashSet<>();\n            for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {\n                if (!taskNameSet.add(taskDefinitionLog.getName())) {\n                    log.error(\n                            \"Generate task definition list failed, the given task definition name is duplicate, taskName: {}, taskDefinition: {}\",\n                            taskDefinitionLog.getName(), taskDefinitionLog);\n                    throw new ServiceException(Status.TASK_NAME_DUPLICATE_ERROR, taskDefinitionLog.getName());\n                }\n\n                if (!checkTaskParameters(taskDefinitionLog.getTaskType(), taskDefinitionLog.getTaskParams())) {\n                    log.error(\n                            \"Generate task definition list failed, the given task definition parameter is invalided, taskName: {}, taskDefinition: {}\",\n                            taskDefinitionLog.getName(), taskDefinitionLog);\n                    throw new ServiceException(Status.WORKFLOW_NODE_S_PARAMETER_INVALID, taskDefinitionLog.getName());\n                }\n            }","sourceCodeStart":345,"sourceCodeEnd":381,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java#L345-L381","documentation":"Thrown by generateTaskDefinitionList when the taskDefinitionJson request parameter cannot be parsed into any TaskDefinitionLog entries, or parses to an empty list. The API requires a valid, non-empty JSON array of task definitions when saving/updating a workflow. It signals malformed request payload data rather than a server fault.","triggerScenarios":"Calling importWorkflowDefinition or updateWorkflowDefinition with taskDefinitionJson that is null, empty string, invalid JSON, valid JSON but not an array, or an empty array [].","commonSituations":"Hand-edited workflow JSON with a syntax error; exporting from one DolphinScheduler version and importing into another where the format changed; passing the wrong JSON field (e.g. relations instead of task definitions); forgetting to URL-encode the parameter in the REST call.","solutions":["Validate taskDefinitionJson is a non-empty JSON array of task-definition objects before calling the API","Re-export the workflow definition from the source instance and use that JSON verbatim","Check JSON syntax with a linter/parser (trailing commas, unquoted keys are common)","Confirm you are on matching DolphinScheduler versions between export and import"],"exampleFix":"// before\ncallApi(taskDefinitionJson = \"\")\n// after\nList<TaskDefinitionLog> defs = JSONUtils.toList(json, TaskDefinitionLog.class);\nif (CollectionUtils.isEmpty(defs)) { throw new IllegalArgumentException(\"taskDefinitionJson must be a non-empty array\"); }","handlingStrategy":"validation","validationCode":"boolean valid = json != null && JSONUtils.toList(json, TaskDefinitionLog.class) != null && !JSONUtils.toList(json, TaskDefinitionLog.class).isEmpty();\nif (!valid) throw new IllegalArgumentException(\"taskDefinitionJson must be a non-empty JSON array\");","typeGuard":"static boolean isNonEmptyTaskDefinitionJson(String s) { List<TaskDefinitionLog> l = JSONUtils.toList(s, TaskDefinitionLog.class); return l != null && !l.isEmpty(); }","tryCatchPattern":"try { api.updateWorkflowDefinition(...) } catch (ServiceException e) { if (e.getCode() == 50017) { /* fix taskDefinitionJson payload */ } }","preventionTips":["Always export JSON from the UI as a template","Parse-then-send: validate JSON locally before the API call","Pin matching versions across environments"],"tags":["api","json","validation","dolphinscheduler"],"backgroundTag":"json-unmarshal-failed","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"}