{"record":{"id":"37d3ae1adc941e3f","repo":"apache/dolphinscheduler","slug":"50008","errorCode":"50008","errorMessage":"workflow definition {0} does not allow edit","messagePattern":"workflow definition (.+?) does not allow edit","errorType":"exception","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java","lineNumber":648,"sourceCode":"            throw new ServiceException(Status.DESCRIPTION_TOO_LONG_ERROR);\n        }\n\n        globalParamsValidator.validate(globalParams);\n\n        List<TaskDefinitionLog> taskDefinitionLogs = generateTaskDefinitionList(taskDefinitionJson);\n        List<WorkflowTaskRelationLog> taskRelationList = generateTaskRelationList(taskRelationJson, taskDefinitionLogs);\n\n        WorkflowDefinition workflowDefinition = workflowDefinitionDao.queryByCode(code).orElse(null);\n        // check workflow definition exists\n        if (workflowDefinition == null || projectCode != workflowDefinition.getProjectCode()) {\n            log.error(\"workflow definition does not exist, workflowDefinitionCode:{}.\", code);\n            throw new ServiceException(Status.WORKFLOW_DEFINITION_NOT_EXIST, String.valueOf(code));\n        }\n        if (workflowDefinition.getReleaseState() == ReleaseState.ONLINE) {\n            // online can not permit edit\n            log.warn(\"workflow definition is not allowed to be modified due to {}, workflowDefinitionCode:{}.\",\n                    ReleaseState.ONLINE.getDescp(), workflowDefinition.getCode());\n            throw new ServiceException(Status.WORKFLOW_DEFINITION_NOT_ALLOWED_EDIT, workflowDefinition.getName());\n        }\n        if (!name.equals(workflowDefinition.getName())) {\n            // check whether the new workflow define name exist\n            WorkflowDefinition definition = workflowDefinitionDao.verifyByDefineName(project.getCode(), name);\n            if (definition != null) {\n                log.warn(\"workflow definition with the same name already exists, workflowDefinitionCode:{}.\",\n                        definition.getCode());\n                throw new ServiceException(Status.WORKFLOW_DEFINITION_NAME_EXIST, name);\n            }\n        }\n        WorkflowDefinition workflowDefinitionDeepCopy =\n                JSONUtils.parseObject(JSONUtils.toJsonString(workflowDefinition), WorkflowDefinition.class);\n        workflowDefinition.set(projectCode, name, description, globalParams, locations, timeout);\n        workflowDefinition.setExecutionType(executionType);\n        return updateDagDefine(loginUser, taskRelationList, workflowDefinition, workflowDefinitionDeepCopy,\n                taskDefinitionLogs);\n    }\n","sourceCodeStart":630,"sourceCodeEnd":666,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkflowDefinitionServiceImpl.java#L630-L666","documentation":"Thrown in WorkflowDefinitionServiceImpl.updateWorkflowDefinition when the workflow's releaseState is ReleaseState.ONLINE: a published (online) workflow definition is immutable and cannot be edited. The guard fires on any update request against an online workflow, independent of whether the payload is valid.","triggerScenarios":"Calling updateWorkflowDefinition (or batch operations routed through updateDagDefine) against a workflow with releaseState == ReleaseState.ONLINE.","commonSituations":"Editing a production workflow from the API without scheduling it offline first, automation that assumes draft state, batch scripts hitting ONLINE workflows.","solutions":["Take the workflow offline (releaseWorkflow / UI set offline) before editing","Re-release it ONLINE after the update completes","Skip ONLINE workflows in batch scripts and only edit offline ones"],"exampleFix":"// before\nupdateWorkflowDefinition(user, projectCode, code, ...) // workflow is ONLINE\n// after\nreleaseWorkflowDefinition(user, projectCode, code, ReleaseState.OFFLINE);\nupdateWorkflowDefinition(user, projectCode, code, ...);\nreleaseWorkflowDefinition(user, projectCode, code, ReleaseState.ONLINE);","handlingStrategy":"validation","validationCode":"WorkflowDefinition wf = workflowDefinitionDao.queryByCode(code).orElse(null);\nif (wf != null && wf.getReleaseState() == ReleaseState.ONLINE) { /* take offline first */ }","typeGuard":"boolean isEditable(WorkflowDefinition wf) { return wf != null && wf.getReleaseState() != ReleaseState.ONLINE; }","tryCatchPattern":"try { ... } catch (ServiceException e) { if (e.getCode() == 50008) { /* release offline, retry, re-release */ } }","preventionTips":["Check release state before any edit or batch edit","Automate offline->edit->online sequences","Filter ONLINE workflows out of batch update scripts"],"tags":["workflow","state","online"],"backgroundTag":"invalid-state-transition","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"}