{"record":{"id":"bf6b668aafcd32b1","repo":"apache/dolphinscheduler","slug":"schedule-cron-not-exists","errorCode":"SCHEDULE_CRON_NOT_EXISTS","errorMessage":"SCHEDULE_CRON_NOT_EXISTS: schedule of workflow definition {workflowDefinitionCode} does not exist","messagePattern":"SCHEDULE_CRON_NOT_EXISTS: schedule of workflow definition (.+?) does not exist","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java","lineNumber":436,"sourceCode":"                                                           long projectCode,\n                                                           long workflowDefinitionCode,\n                                                           String scheduleExpression,\n                                                           WarningType warningType,\n                                                           int warningGroupId,\n                                                           FailureStrategy failureStrategy,\n                                                           Priority workflowInstancePriority,\n                                                           String workerGroup,\n                                                           String tenantCode,\n                                                           long environmentCode) {\n        Project project = projectDao.queryByCode(projectCode);\n        projectService.checkHasProjectWritePermissionThrowException(loginUser, project);\n\n        // check schedule exists\n        Schedule schedule = scheduleDao.queryByWorkflowDefinitionCode(workflowDefinitionCode);\n        if (schedule == null) {\n            log.error(\"Schedule of workflow definition does not exist, workflowDefinitionCode:{}.\",\n                    workflowDefinitionCode);\n            throw new ServiceException(Status.SCHEDULE_CRON_NOT_EXISTS, workflowDefinitionCode);\n        }\n\n        WorkflowDefinition workflowDefinition = workflowDefinitionDao.queryByCode(workflowDefinitionCode).orElse(null);\n        if (workflowDefinition == null || projectCode != workflowDefinition.getProjectCode()) {\n            log.error(\"workflow definition does not exist, workflowDefinitionCode:{}.\", workflowDefinitionCode);\n            throw new ServiceException(Status.WORKFLOW_DEFINITION_NOT_EXIST,\n                    String.valueOf(workflowDefinitionCode));\n        }\n\n        return updateSchedule(schedule, workflowDefinition, scheduleExpression, warningType, warningGroupId,\n                failureStrategy, workflowInstancePriority, workerGroup, tenantCode, environmentCode);\n    }\n\n    @Transactional\n    @Override\n    public void onlineScheduler(User loginUser, Long projectCode, Integer schedulerId) {\n        projectService.checkHasProjectWritePermissionThrowException(loginUser, projectCode);\n        Schedule schedule = scheduleDao.queryById(schedulerId);","sourceCodeStart":418,"sourceCodeEnd":454,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/SchedulerServiceImpl.java#L418-L454","documentation":"updateScheduleByWorkflowDefinitionCode looks up a Schedule row by workflowDefinitionCode; when scheduleDao.queryByWorkflowDefinitionCode returns null there is no schedule configured for that workflow, so the update is refused. This is a precondition check before any mutation.","triggerScenarios":"Calling updateScheduleByWorkflowDefinitionCode with a workflowDefinitionCode that has never had a schedule created (createSchedule never called, or schedule deleted), or with a mistyped/non-existent code.","commonSituations":"Automation scripts updating schedules right after creating a workflow definition but before creating the schedule; using the workflow definition id instead of code; schedule removed by another user/process.","solutions":["Create the schedule first (SchedulerService.createSchedule) for the workflow definition code, then update it.","Verify the workflowDefinitionCode exists in t_ds_workflow_definition and has a matching row in the schedule table.","Check the correct code (long code, not the numeric id) is passed.","Query the schedule via the API before updating to confirm existence."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"Schedule existing = scheduleDao.queryByWorkflowDefinitionCode(workflowDefinitionCode);\nif (existing == null) {\n    throw new IllegalStateException(\"No schedule for workflow code \" + workflowDefinitionCode);\n}","typeGuard":null,"tryCatchPattern":"try {\n    schedulerService.updateScheduleByWorkflowDefinitionCode(loginUser, projectCode, code, ...);\n} catch (ServiceException e) {\n    if (e.getCode() == Status.SCHEDULE_CRON_NOT_EXISTS.getCode()) {\n        // create the schedule first or fail the pipeline with a clear message\n    }\n}","preventionTips":["Always createSchedule before attempting updates by workflow code","Use the workflow code (not id) and confirm it exists","Query the schedule before updating in automation scripts","Handle schedule deletion events that may race with updates"],"tags":["scheduler","resource-not-found","workflow"],"backgroundTag":"entity-not-found","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"}