{"record":{"id":"f0df0da81bdb549a","repo":"apache/dolphinscheduler","slug":"request-params-not-valid-error-f0df0d","errorCode":"REQUEST_PARAMS_NOT_VALID_ERROR","errorMessage":"Parameter releaseState is invalid.","messagePattern":"Parameter releaseState is invalid\\.","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java","lineNumber":382,"sourceCode":"                        Collections.singletonList(taskDefinitionLog));\n                String resourceIds = taskDefinition.getResourceIds();\n                if (StringUtils.isNotBlank(resourceIds)) {\n                    Integer[] resourceIdArray =\n                            Arrays.stream(resourceIds.split(\",\")).map(Integer::parseInt).toArray(Integer[]::new);\n                    PermissionCheck<Integer> permissionCheck = new PermissionCheck(AuthorizationType.RESOURCE_FILE_ID,\n                            processService, resourceIdArray, loginUser.getId(), log);\n                    try {\n                        permissionCheck.checkPermission();\n                    } catch (Exception e) {\n                        log.error(\"Resources permission check error, resourceIds:{}.\", resourceIds, e);\n                        throw new ServiceException(Status.RESOURCE_NOT_EXIST_OR_NO_PERMISSION);\n                    }\n                }\n                taskDefinition.setFlag(Flag.YES);\n                taskDefinitionLog.setFlag(Flag.YES);\n                break;\n            default:\n                log.warn(\"Parameter releaseState is invalid.\");\n                throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.RELEASE_STATE);\n        }\n        boolean updateSuccess = taskDefinitionDao.updateById(taskDefinition);\n        int updateLog = taskDefinitionLogMapper.updateById(taskDefinitionLog);\n        if (updateSuccess != (updateLog == 1)) {\n            log.error(\"Update taskDefinition state or taskDefinitionLog state error, taskDefinitionCode:{}.\", code);\n            throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR);\n        }\n        log.info(\"Update taskDefinition state or taskDefinitionLog state to complete, taskDefinitionCode:{}.\",\n                code);\n    }\n\n    @Override\n    public void deleteTaskByWorkflowDefinitionCode(long workflowDefinitionCode, int workflowDefinitionVersion) {\n        List<WorkflowTaskRelation> workflowTaskRelations = workflowTaskRelationService\n                .queryByWorkflowDefinitionCode(workflowDefinitionCode, workflowDefinitionVersion);\n        if (CollectionUtils.isEmpty(workflowTaskRelations)) {\n            return;","sourceCodeStart":364,"sourceCodeEnd":400,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java#L364-L400","documentation":"releaseTaskDefinition toggles a task definition between ONLINE/OFFLINE via a releaseState parameter; the switch statement only handles known values. Any releaseState outside the accepted enum falls into the default branch and throws ServiceException(REQUEST_PARAMS_NOT_VALID_ERROR, \"releaseState\"). The parameter name is interpolated into the error by the status message formatter.","triggerScenarios":"POSTing to the task-definition release endpoint with releaseState values other than the accepted constants (e.g. 0/1 vs the expected codes, a string like 'online', or an arbitrary number).","commonSituations":"API consumers guessing the numeric encoding of release states; older clients built against a changed enum; copy-pasted curl commands with releaseState=2; UI sending undefined because a toggle control was never initialized.","solutions":["Send releaseState using the exact accepted value for ONLINE or OFFLINE as defined by the server enum.","Inspect the task definition's current state first and only send a valid transition target.","Fix client code that maps 'ONLINE'/'OFFLINE' strings to numeric codes incorrectly.","Upgrade the UI/SDK if it predates the current release-state encoding."],"exampleFix":"// before\nawait post('/task-definition/release', { code, version, releaseState: 'online' })\n// after\nimport { ReleaseState } from '@/service/modules/task-definition'\nawait post('/task-definition/release', { code, version, releaseState: ReleaseState.ONLINE })","handlingStrategy":"validation","validationCode":"const RELEASE_STATES = new Set([0, 1]) // ONLINE / OFFLINE per server enum\nfunction canRelease(releaseState: unknown): releaseState is number {\n  return typeof releaseState === 'number' && RELEASE_STATES.has(releaseState)\n}","typeGuard":"function isReleaseState(v: unknown): v is 0 | 1 {\n  return v === 0 || v === 1\n}","tryCatchPattern":"try {\n  await releaseTaskDefinition({ code, version, releaseState })\n} catch (e) {\n  if (isServiceException(e, 'REQUEST_PARAMS_NOT_VALID_ERROR')) {\n    toast(`Invalid releaseState: ${releaseState}. Use the ReleaseState enum values.`)\n  } else throw e\n}","preventionTips":["Import and use the shared ReleaseState enum from the SDK/UI service module instead of raw numbers.","Bind UI toggles directly to enum values, not ad-hoc strings.","Consult the controller/DTO javadoc for the accepted releaseState encoding before integrating."],"tags":["parameter-validation","enum","api"],"backgroundTag":"invalid-enum-value","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}