apache/dolphinscheduler · error

50061

50061

Error message

create task definition log {0} error

What it means

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.

Source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java:402

    DELETE_TASK_DEFINITION_VERSION_ERROR(50041, "delete task definition version error", "删除任务历史版本出错"),
    DELETE_TASK_DEFINE_BY_CODE_ERROR(50042, "delete task definition by code error", "删除任务定义错误"),
    QUERY_DETAIL_OF_TASK_DEFINITION_ERROR(50043, "query detail of task definition error", "查询任务详细信息错误"),
    QUERY_TASK_DEFINITION_LIST_PAGING_ERROR(50044, "query task definition list paging error", "分页查询任务定义列表错误"),
    TASK_DEFINITION_NAME_EXISTED(50045, "task definition name [{0}] already exists", "任务定义名称[{0}]已经存在"),
    RELEASE_TASK_DEFINITION_ERROR(50046, "release task definition error", "上线任务错误"),
    MOVE_WORKFLOW_TASK_RELATION_ERROR(50047, "move workflow task relation error", "移动任务到其他工作流错误"),
    DELETE_TASK_WORKFLOW_RELATION_ERROR(50048, "delete workflow task relation error", "删除工作流任务关系错误"),
    QUERY_TASK_WORKFLOW_RELATION_ERROR(50049, "query workflow task relation error", "查询工作流任务关系错误"),
    TASK_DEFINITION_STATE_ONLINE(50050, "task definition [{0}] is already online", "任务定义[{0}]已上线"),
    TASK_HAS_DOWNSTREAM(50051, "Task exists downstream [{0}] dependence", "任务存在下游[{0}]依赖"),
    TASK_HAS_UPSTREAM(50052, "Task [{0}] exists upstream dependence", "任务[{0}]存在上游依赖"),
    MAIN_TABLE_USING_VERSION(50053, "the version that the master table is using", "主表正在使用该版本"),
    PROJECT_WORKFLOW_NOT_MATCH(50054, "the project and the workflow is not match", "项目和工作流不匹配"),
    DELETE_EDGE_ERROR(50055, "delete edge error", "删除工作流任务连接线错误"),
    BATCH_EXECUTE_WORKFLOW_INSTANCE_ERROR(50058, "change workflow instance status error: {0}", "修改工作实例状态错误: {0}"),
    START_TASK_INSTANCE_ERROR(50059, "start task instance error", "运行任务流实例错误"),
    DELETE_WORKFLOW_DEFINE_ERROR(50060, "delete workflow definition [{0}] error: {1}", "删除工作流定义[{0}]错误: {1}"),
    CREATE_TASK_DEFINITION_LOG_ERROR(50061, "create task definition log {0} error", "创建任务操作记录 {0} 错误"),
    DELETE_TASK_DEFINE_BY_CODE_MSG_ERROR(50062, "delete task definition {0} error", "删除任务定义 {0} 错误"),
    TASK_DEFINITION_NOT_EXISTS(50064, "task definition {0} do not exists", "任务定义 {0} 不存在"),
    WORKFLOW_TASK_RELATION_NOT_EXPECT(50067, "workflow task relation number not expect, expect {0} but get {1}",
            "工作流任务关系数量不符合预期,预期 {0} 但是实际 {1}"),
    WORKFLOW_TASK_RELATION_BATCH_DELETE_ERROR(50068, "batch delete workflow task relation {0} error",
            "批量删除工作流任务关系 {0} 错误"),
    WORKFLOW_TASK_RELATION_BATCH_CREATE_ERROR(50069, "batch create workflow task relation {0} error",
            "批量创建工作流任务关系 {0} 错误"),
    WORKFLOW_INSTANCE_IS_NOT_FINISHED(50071, "the workflow instance is not finished, can not do this operation",
            "工作流实例未结束,不能执行此操作"),

    TASK_PARALLELISM_PARAMS_ERROR(50080, "task parallelism parameter is not valid", "任务并行度参数无效"),
    TASK_COMPLEMENT_DATA_DATE_ERROR(50081, "The range of date for complementing date is not valid", "补数选择的日期范围无效"),

    HDFS_NOT_STARTUP(60001, "hdfs not startup", "hdfs未启用"),
    STORAGE_NOT_STARTUP(60002, "storage not startup", "存储未启用"),
    S3_CANNOT_RENAME(60003, "directory cannot be renamed", "S3无法重命名文件夹"),
    /**

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Look up the task named in '{0}' and check api-server logs for the wrapped SQL exception
  2. Retry the save after confirming no concurrent editor holds a lock on the workflow/task
  3. Verify t_ds_workflow_task_definition_log schema matches your DolphinScheduler version (run pending upgrade migrations)
  4. Check DB health (disk space, connection pool, lock waits) and retry
  5. Re-import the workflow from a known-good export if definition codes are corrupted

Example fix

// before: task log insert result unchecked
int insertVersion = taskDefinitionLogMapper.insert(taskDefinitionLog);
saveTaskRelation(loginUser, projectCode, workflowCode, taskDefinitionLog);
// after: check and surface CREATE_TASK_DEFINITION_LOG_ERROR with the task name
int insertVersion = taskDefinitionLogMapper.insert(taskDefinitionLog);
if (insertVersion != 1) {
    throw new ServiceException(Status.CREATE_TASK_DEFINITION_LOG_ERROR, taskDefinitionLog.getName());
}
saveTaskRelation(loginUser, projectCode, workflowCode, taskDefinitionLog);
Defensive patterns

Strategy: try-catch

Validate before calling

// validate the task payload and DB table before persisting
DatabaseMetaData md = connection.getMetaData();
if (!md.getTables(null, null, "t_ds_workflow_task_definition_log", null).next()) {
    throw new IllegalStateException("t_ds_workflow_task_definition_log missing - migrations not applied");
}
// task name must be unique within the workflow
if (taskNamesInWorkflow.contains(taskDefinition.getName())) {
    throw new IllegalArgumentException("duplicate task name: " + taskDefinition.getName());
}

Type guard

static boolean taskPersistable(TaskDefinition t) {
    return t != null && t.getCode() != 0 && StringUtils.isNotBlank(t.getName()) && t.getTaskType() != null;
}

Try / catch

try {
    Map<String, Object> result = taskDefinitionService.saveTaskDefinition(loginUser, projectCode, params);
} catch (ServiceException e) {
    if (e.getCode() == 50061) {
        // task definition log insert failed; the message names the task
        log.error("task definition log insert failed: {}", e.getMessage());
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/993de63a248734c9. Report an issue: GitHub.