apache/dolphinscheduler · error · ServiceException
CREATE_SCHEDULE_ERROR
CREATE_SCHEDULE_ERROR
Error message
CREATE_SCHEDULE_ERROR: create schedule error
What it means
Thrown from the batch copy-workflow flow when copying a workflow's schedule row fails: scheduleDao.insert() returns a row count other than 1, so the copied schedule could not be persisted. It is a Spring @Transactional ServiceException, so the whole copy operation (including the already-inserted workflow definition) is rolled back. It signals a database-layer write problem or constraint violation on the t_ds_schedule table, not a user-input problem.
Source
Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java:1421
ObjectNode node = (ObjectNode) jsonNodes.path(i);
node.put("taskCode", taskCodeMap.get(node.get("taskCode").asLong()));
jsonNodes.set(i, node);
}
workflowDefinition.setLocations(JSONUtils.toJsonString(jsonNodes));
}
// copy timing configuration
Schedule scheduleObj = scheduleDao.queryByWorkflowDefinitionCode(oldWorkflowDefinitionCode);
if (scheduleObj != null) {
scheduleObj.setId(null);
scheduleObj.setUserId(loginUser.getId());
scheduleObj.setWorkflowDefinitionCode(workflowDefinition.getCode());
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
scheduleObj.setCreateTime(date);
scheduleObj.setUpdateTime(date);
int insertResult = scheduleDao.insert(scheduleObj);
if (insertResult != 1) {
log.error("Schedule create error, workflowDefinitionCode:{}.", workflowDefinition.getCode());
throw new ServiceException(Status.CREATE_SCHEDULE_ERROR);
}
}
try {
createDagDefine(loginUser, taskRelationList, workflowDefinition, taskDefinitionLogs);
} catch (Exception e) {
log.error("Copy workflow definition error, workflowDefinitionCode from {} to {}.",
oldWorkflowDefinitionCode, workflowDefinition.getCode(), e);
failedWorkflowList.add(workflowDefinition.getCode() + "[" + workflowDefinition.getName() + "]");
}
} else {
log.info("Move workflow definition...");
try {
updateDagDefine(loginUser, taskRelationList, workflowDefinition, null,
Lists.newArrayList());
} catch (Exception e) {
log.error("Move workflow definition error, workflowDefinitionCode:{}.",
workflowDefinition.getCode(), e);
failedWorkflowList.add(workflowDefinition.getCode() + "[" + workflowDefinition.getName() + "]");View on GitHub (pinned to 02eac45a1b)
Solutions
- Check API server logs for the preceding 'Schedule create error, workflowDefinitionCode:...' entry and the underlying SQL exception from the DB; fix the datasource config in application.yaml if it's connectivity.
- Verify t_ds_schedule schema matches the version expected by your DolphinScheduler release (run the appropriate upgrade SQL scripts).
- Retry the copy once the database is healthy; the copy is transactional so no partial data remains.
- If the source workflow has a stale/orphan schedule row, delete or fix it via the UI (Timing management) before copying.
Example fix
// There is no user-side code fix; operator action example: // before: DB unreachable / schema mismatch -> insert returns != 1 // after: verify datasource & schema ./bin/start.sh # after checking application.yaml datasource url/user and running dolphinscheduler_mysql.sql upgrades
Defensive patterns
Strategy: retry
Validate before calling
// Verify DB connectivity and that the source workflow has a schedule before copying
Schedule srcSchedule = scheduleDao.queryByWorkflowDefinitionCode(srcWorkflowCode);
if (srcSchedule != null) { /* copy will attempt a schedule insert; ensure DB is healthy */ } Try / catch
try {
workflowDefinitionService.copyWorkflowDefinition(...);
} catch (ServiceException e) {
if (e.getCode() == Status.CREATE_SCHEDULE_ERROR) {
// transaction rolled back; check DB health then retry once
}
} Prevention
- Keep the metadata datasource (application.yaml) healthy and monitored.
- Run the DolphinScheduler upgrade SQL scripts after version changes so t_ds_schedule matches the code.
- Retry batch copies after transient DB failures — the copy is transactional and leaves no partial rows.
When it happens
Trigger: Calling the copy-workflow-definition API (copyWorkflowDefinition) for a source workflow that HAS a schedule, when scheduleDao.insert(scheduleObj) returns 0 or -1 — e.g. DB connection failure, unique constraint collision on the new schedule row, or schema mismatch in t_ds_schedule.
Common situations: Database connectivity hiccups or failover mid-copy; a corrupted/legacy t_ds_schedule schema after upgrade; running with a read-only or misconfigured metadata DB; batch-copying many workflows when the DB pool is exhausted.
Related errors
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/fdbfbf6d981a683c.
Report an issue: GitHub.