{"record":{"id":"b718646dc7029f1e","repo":"apache/dolphinscheduler","slug":"10201","errorCode":"10201","errorMessage":"Create workflow definition log error","messagePattern":"Create workflow 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":252,"sourceCode":"            \"未指定当前登录用户的租户\"),\n    REVOKE_PROJECT_ERROR(10182, \"revoke project error\", \"撤销项目授权错误\"),\n    QUERY_AUTHORIZED_USER(10183, \"query authorized user error\", \"查询拥有项目权限的用户错误\"),\n    PROJECT_NOT_EXIST(10190, \"This project was not found. Please refresh page.\", \"该项目不存在,请刷新页面\"),\n    TASK_INSTANCE_HOST_IS_NULL(10191, \"task instance host is null\", \"任务实例host为空\"),\n    QUERY_EXECUTING_WORKFLOW_ERROR(10192, \"query executing workflow error\", \"查询运行的工作流实例错误\"),\n    DELETE_WORKFLOW_DEFINITION_USE_BY_OTHER_FAIL(10193,\n            \"delete workflow definition fail, cause used by other tasks: {0}\",\n            \"删除工作流定义失败，被其他任务引用：{0}\"),\n    DELETE_TASK_USE_BY_OTHER_FAIL(10194, \"delete task {0} fail, the reason is that used by other tasks: {1}\",\n            \"删除任务 {0} 失败，被其他任务引用：{1}\"),\n    TASK_WITH_DEPENDENT_ERROR(10195, \"task used in other tasks\", \"删除被其他任务引用\"),\n    TASK_SAVEPOINT_ERROR(10196, \"task savepoint error\", \"任务实例savepoint错误\"),\n    TASK_STOP_ERROR(10197, \"task stop error\", \"任务实例停止错误\"),\n    TASK_NAME_DUPLICATE_ERROR(10198, \"task name {0} duplicate error\", \"同一个工作流中任务名称 {0} 重复\"),\n    LIST_TASK_TYPE_ERROR(10200, \"list task type error\", \"查询任务类型列表错误\"),\n    DELETE_TASK_TYPE_ERROR(10200, \"delete task type error\", \"删除任务类型错误\"),\n    ADD_TASK_TYPE_ERROR(10200, \"add task type error\", \"添加任务类型错误\"),\n    CREATE_WORKFLOW_DEFINITION_LOG_ERROR(10201, \"Create workflow definition log error\",\n            \"创建 workflow definition log 对象失败\"),\n    PARSE_SCHEDULE_PARAM_ERROR(10202, \"Parse schedule parameter error, {0}\", \"解析 schedule 参数错误, {0}\"),\n    SCHEDULE_NOT_EXISTS(10203, \"schedule {0} does not exist\", \"调度 id {0} 不存在\"),\n    SCHEDULE_ALREADY_EXISTS(10204, \"workflow {0} schedule {1} already exist, please update or delete it\",\n            \"工作流 {0} 的定时 {1} 已经存在，请更新或删除\"),\n    QUERY_TASK_INSTANCE_ERROR(10205, \"query task instance error\", \"查询任务实例错误\"),\n    EXECUTE_NOT_DEFINE_TASK(10206, \"please save and try again\",\n            \"请先保存后再执行\"),\n\n    DELETE_QUEUE_BY_ID_ERROR(10307, \"delete queue by id error\", \"删除队列错误\"),\n    DELETE_QUEUE_BY_ID_FAIL_USERS(10308, \"delete queue by id fail, for there are {0} users using it\",\n            \"删除队列失败，有[{0}]个用户正在使用\"),\n    DELETE_TENANT_BY_ID_FAIL_TENANTS(10309, \"delete queue by id fail, for there are {0} tenants using it\",\n            \"删除队列失败，有[{0}]个租户正在使用\"),\n    START_NODE_NOT_EXIST_IN_LAST_WORKFLOW(10207, \"this node {0} does not exist in the latest workflow definition\",\n            \"该节点 {0} 不存在于最新的流程定义中\"),\n    LIST_AZURE_DATA_FACTORY_ERROR(10208, \"list azure data factory error\", \"查询AZURE数据工厂列表错误\"),\n    LIST_AZURE_RESOURCE_GROUP_ERROR(10209, \"list azure resource group error\", \"查询AZURE资源组列表错误\"),","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java#L234-L270","documentation":"CREATE_WORKFLOW_DEFINITION_LOG_ERROR (10201) represents a failure to create a WorkflowDefinitionLog record - the versioned history row written into t_ds_workflow_definition_log whenever a workflow definition is saved, updated, or released. Every definition change inserts a snapshot log row so the scheduler can resolve which version a workflow instance ran on; when that insert fails (returned rows != 1) the API surfaces this status. In the current codebase the insert lives in ProcessServiceImpl.java:533 (saveWorkflowDefinitionLog) and this enum is largely a legacy status kept for API compatibility.","triggerScenarios":"Saving or updating a workflow definition (POST/PUT /dolphinscheduler/workflow-definition... style calls in older releases) where the insert into t_ds_workflow_definition_log returns 0 or throws; database connection failure or constraint violation during the definition-version insert; transaction rollback while persisting the definition snapshot.","commonSituations":"Database out of disk space or t_ds_workflow_definition_log table locked/full during heavy definition churn; upgrading DolphinScheduler versions where schema migration for the *_log tables was not applied; duplicate version rows from concurrent edits of the same workflow by two users.","solutions":["Verify the relational database is writable and the t_ds_workflow_definition_log schema matches your version (run/verify upgrade migrations)","Retry saving the workflow definition - transient DB failures or lock contention often resolve on retry","Check api-server logs for the underlying SQLException/MapperException wrapped by this status","Reduce concurrent edits to the same workflow definition and re-save","If the table has grown huge, archive old version rows and re-attempt the save"],"exampleFix":"// before: ignoring insert result of the definition log row\nint insertLog = workflowDefinitionLogMapper.insert(workflowDefinitionLog);\n// after: fail fast and surface CREATE_WORKFLOW_DEFINITION_LOG_ERROR\nint insertLog = workflowDefinitionLogMapper.insert(workflowDefinitionLog);\nif (insertLog != 1) {\n    throw new ServiceException(Status.CREATE_WORKFLOW_DEFINITION_LOG_ERROR);\n}","handlingStrategy":"try-catch","validationCode":"// pre-check DB writability and schema presence before saving a workflow definition\ntry (Connection c = dataSource.getConnection()) {\n    DatabaseMetaData md = c.getMetaData();\n    if (!md.getTables(null, null, \"t_ds_workflow_definition_log\", null).next()) {\n        throw new IllegalStateException(\"missing t_ds_workflow_definition_log - run upgrade migrations\");\n    }\n}","typeGuard":"static boolean definitionPersistable(WorkflowDefinition d) {\n    return d != null && d.getCode() != 0 && StringUtils.isNotBlank(d.getName()) && d.getProjectCode() != 0;\n}","tryCatchPattern":"try {\n    Map<String, Object> result = workflowDefinitionService.createWorkflowDefinition(loginUser, projectCode, params);\n} catch (ServiceException e) {\n    if (e.getCode() == 10201) {\n        // definition-log insert failed: check DB health and retry the save\n        log.error(\"workflow definition log insert failed\", e);\n    } else {\n        throw e;\n    }\n}","preventionTips":["Apply all schema upgrade migrations before starting a new api-server version","Avoid two users editing the same workflow definition concurrently; use the version history UI to reconcile","Monitor metadata DB disk space and lock waits","Keep the *_log tables pruned/archived so inserts stay fast"],"tags":["api","database","workflow-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"}