{"record":{"id":"993de63a248734c9","repo":"apache/dolphinscheduler","slug":"50061","errorCode":"50061","errorMessage":"create task definition log {0} error","messagePattern":"create task definition log (.+?) error","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java","lineNumber":402,"sourceCode":"    DELETE_TASK_DEFINITION_VERSION_ERROR(50041, \"delete task definition version error\", \"删除任务历史版本出错\"),\n    DELETE_TASK_DEFINE_BY_CODE_ERROR(50042, \"delete task definition by code error\", \"删除任务定义错误\"),\n    QUERY_DETAIL_OF_TASK_DEFINITION_ERROR(50043, \"query detail of task definition error\", \"查询任务详细信息错误\"),\n    QUERY_TASK_DEFINITION_LIST_PAGING_ERROR(50044, \"query task definition list paging error\", \"分页查询任务定义列表错误\"),\n    TASK_DEFINITION_NAME_EXISTED(50045, \"task definition name [{0}] already exists\", \"任务定义名称[{0}]已经存在\"),\n    RELEASE_TASK_DEFINITION_ERROR(50046, \"release task definition error\", \"上线任务错误\"),\n    MOVE_WORKFLOW_TASK_RELATION_ERROR(50047, \"move workflow task relation error\", \"移动任务到其他工作流错误\"),\n    DELETE_TASK_WORKFLOW_RELATION_ERROR(50048, \"delete workflow task relation error\", \"删除工作流任务关系错误\"),\n    QUERY_TASK_WORKFLOW_RELATION_ERROR(50049, \"query workflow task relation error\", \"查询工作流任务关系错误\"),\n    TASK_DEFINITION_STATE_ONLINE(50050, \"task definition [{0}] is already online\", \"任务定义[{0}]已上线\"),\n    TASK_HAS_DOWNSTREAM(50051, \"Task exists downstream [{0}] dependence\", \"任务存在下游[{0}]依赖\"),\n    TASK_HAS_UPSTREAM(50052, \"Task [{0}] exists upstream dependence\", \"任务[{0}]存在上游依赖\"),\n    MAIN_TABLE_USING_VERSION(50053, \"the version that the master table is using\", \"主表正在使用该版本\"),\n    PROJECT_WORKFLOW_NOT_MATCH(50054, \"the project and the workflow is not match\", \"项目和工作流不匹配\"),\n    DELETE_EDGE_ERROR(50055, \"delete edge error\", \"删除工作流任务连接线错误\"),\n    BATCH_EXECUTE_WORKFLOW_INSTANCE_ERROR(50058, \"change workflow instance status error: {0}\", \"修改工作实例状态错误: {0}\"),\n    START_TASK_INSTANCE_ERROR(50059, \"start task instance error\", \"运行任务流实例错误\"),\n    DELETE_WORKFLOW_DEFINE_ERROR(50060, \"delete workflow definition [{0}] error: {1}\", \"删除工作流定义[{0}]错误: {1}\"),\n    CREATE_TASK_DEFINITION_LOG_ERROR(50061, \"create task definition log {0} error\", \"创建任务操作记录 {0} 错误\"),\n    DELETE_TASK_DEFINE_BY_CODE_MSG_ERROR(50062, \"delete task definition {0} error\", \"删除任务定义 {0} 错误\"),\n    TASK_DEFINITION_NOT_EXISTS(50064, \"task definition {0} do not exists\", \"任务定义 {0} 不存在\"),\n    WORKFLOW_TASK_RELATION_NOT_EXPECT(50067, \"workflow task relation number not expect, expect {0} but get {1}\",\n            \"工作流任务关系数量不符合预期，预期 {0} 但是实际 {1}\"),\n    WORKFLOW_TASK_RELATION_BATCH_DELETE_ERROR(50068, \"batch delete workflow task relation {0} error\",\n            \"批量删除工作流任务关系 {0} 错误\"),\n    WORKFLOW_TASK_RELATION_BATCH_CREATE_ERROR(50069, \"batch create workflow task relation {0} error\",\n            \"批量创建工作流任务关系 {0} 错误\"),\n    WORKFLOW_INSTANCE_IS_NOT_FINISHED(50071, \"the workflow instance is not finished, can not do this operation\",\n            \"工作流实例未结束，不能执行此操作\"),\n\n    TASK_PARALLELISM_PARAMS_ERROR(50080, \"task parallelism parameter is not valid\", \"任务并行度参数无效\"),\n    TASK_COMPLEMENT_DATA_DATE_ERROR(50081, \"The range of date for complementing date is not valid\", \"补数选择的日期范围无效\"),\n\n    HDFS_NOT_STARTUP(60001, \"hdfs not startup\", \"hdfs未启用\"),\n    STORAGE_NOT_STARTUP(60002, \"storage not startup\", \"存储未启用\"),\n    S3_CANNOT_RENAME(60003, \"directory cannot be renamed\", \"S3无法重命名文件夹\"),\n    /**","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java#L384-L420","documentation":"CREATE_TASK_DEFINITION_LOG_ERROR (50061) signals that the API failed to create a TaskDefinitionLog - the versioned operation-record row in t_ds_workflow_task_definition_log written whenever a task definition is created, updated, or synced into a workflow. The '{0}' parameter carries the task name/code so you can tell which task's version record could not be persisted. Like its workflow counterpart, the actual insert is done via TaskDefinitionLogMapper and the failure typically comes from the database layer being wrapped into this status.","triggerScenarios":"Saving a task definition or workflow containing tasks where the insert into t_ds_workflow_task_definition_log returns != 1 or throws; DB constraint/connection failures during the task-version snapshot write; concurrent modification of the same task definition code by two save operations.","commonSituations":"Two users editing the same workflow task simultaneously causing version conflicts; database migration not applied so the task definition log table lacks required columns; disk-full or lock-timeout on the metadata DB during bulk workflow import; stale task definition codes after a failed import/export round-trip.","solutions":["Look up the task named in '{0}' and check api-server logs for the wrapped SQL exception","Retry the save after confirming no concurrent editor holds a lock on the workflow/task","Verify t_ds_workflow_task_definition_log schema matches your DolphinScheduler version (run pending upgrade migrations)","Check DB health (disk space, connection pool, lock waits) and retry","Re-import the workflow from a known-good export if definition codes are corrupted"],"exampleFix":"// before: task log insert result unchecked\nint insertVersion = taskDefinitionLogMapper.insert(taskDefinitionLog);\nsaveTaskRelation(loginUser, projectCode, workflowCode, taskDefinitionLog);\n// after: check and surface CREATE_TASK_DEFINITION_LOG_ERROR with the task name\nint insertVersion = taskDefinitionLogMapper.insert(taskDefinitionLog);\nif (insertVersion != 1) {\n    throw new ServiceException(Status.CREATE_TASK_DEFINITION_LOG_ERROR, taskDefinitionLog.getName());\n}\nsaveTaskRelation(loginUser, projectCode, workflowCode, taskDefinitionLog);","handlingStrategy":"try-catch","validationCode":"// validate the task payload and DB table before persisting\nDatabaseMetaData md = connection.getMetaData();\nif (!md.getTables(null, null, \"t_ds_workflow_task_definition_log\", null).next()) {\n    throw new IllegalStateException(\"t_ds_workflow_task_definition_log missing - migrations not applied\");\n}\n// task name must be unique within the workflow\nif (taskNamesInWorkflow.contains(taskDefinition.getName())) {\n    throw new IllegalArgumentException(\"duplicate task name: \" + taskDefinition.getName());\n}","typeGuard":"static boolean taskPersistable(TaskDefinition t) {\n    return t != null && t.getCode() != 0 && StringUtils.isNotBlank(t.getName()) && t.getTaskType() != null;\n}","tryCatchPattern":"try {\n    Map<String, Object> result = taskDefinitionService.saveTaskDefinition(loginUser, projectCode, params);\n} catch (ServiceException e) {\n    if (e.getCode() == 50061) {\n        // task definition log insert failed; the message names the task\n        log.error(\"task definition log insert failed: {}\", e.getMessage());\n    } else {\n        throw e;\n    }\n}","preventionTips":["Serialize saves of workflows containing the same task definition (no concurrent editors)","Run all DAO upgrade migrations when upgrading DolphinScheduler","Validate task names/types client-side before save to reduce failed partial writes","Watch metadata DB health (space, connections, locks) - most *_log insert failures trace back to it"],"tags":["api","database","task-definition","persistence"],"backgroundTag":"database-write-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"}