{"record":{"id":"123099c68aa9c8aa","repo":"apache/dolphinscheduler","slug":"10001-123099","errorCode":"10001","errorMessage":"request parameter {0} is not valid","messagePattern":"request parameter (.+?) is not valid","errorType":"error_code","errorClass":"ServiceException","httpStatus":null,"severity":"warning","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java","lineNumber":343,"sourceCode":"        return taskCodes;\n    }\n\n    /**\n     * release task definition\n     *\n     * @param loginUser    login user\n     * @param projectCode  project code\n     * @param code         task definition code\n     * @param releaseState releaseState\n     */\n    @Transactional\n    @Override\n    public void releaseTaskDefinition(User loginUser, long projectCode, long code, ReleaseState releaseState) {\n        Project project = projectDao.queryByCode(projectCode);\n        projectService.checkHasProjectWritePermissionThrowException(loginUser, project);\n\n        if (null == releaseState) {\n            throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.RELEASE_STATE);\n        }\n        TaskDefinition taskDefinition = taskDefinitionDao.queryByCode(code);\n        if (taskDefinition == null || projectCode != taskDefinition.getProjectCode()) {\n            throw new ServiceException(Status.TASK_DEFINE_NOT_EXIST, String.valueOf(code));\n        }\n        TaskDefinitionLog taskDefinitionLog =\n                taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(code, taskDefinition.getVersion());\n        if (taskDefinitionLog == null) {\n            log.error(\"Task definition does not exist, taskDefinitionCode:{}.\", code);\n            throw new ServiceException(Status.TASK_DEFINE_NOT_EXIST, String.valueOf(code));\n        }\n        switch (releaseState) {\n            case OFFLINE:\n                taskDefinition.setFlag(Flag.NO);\n                taskDefinitionLog.setFlag(Flag.NO);\n                break;\n            case ONLINE:\n                taskDatasourcePermissionChecker.checkPermission(loginUser,","sourceCodeStart":325,"sourceCodeEnd":361,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java#L325-L361","documentation":"Thrown when releasing (online/offline) a task definition and the releaseState parameter is null. ReleaseTaskDefinition requires an explicit ReleaseState (ONLINE or OFFLINE); a missing state cannot be mapped to a valid transition, so the request is rejected before any lookup.","triggerScenarios":"POST .../task-definition/{code}/release without the releaseState body/query parameter, or passing JSON that deserializes releaseState to null (wrong field name, invalid enum string silently coerced).","commonSituations":"API clients forgetting the releaseState field; sending \"Online\"/\"online\" casing or misspelled enum values that fail to bind; copy-pasted requests missing the body.","solutions":["Always pass releaseState explicitly as ONLINE or OFFLINE (exact enum spelling).","Validate the value against ReleaseState.values() client-side before sending the request.","Catch ServiceException code 10001 and log which parameter was invalid (the message includes the parameter name RELEASE_STATE)."],"exampleFix":"// before\nclient.releaseTaskDefinition(loginUser, projectCode, code, null); // 10001\n// after\nReleaseState state = ReleaseState.OFFLINE;\nclient.releaseTaskDefinition(loginUser, projectCode, code, state);","handlingStrategy":"validation","validationCode":"boolean valid = Arrays.stream(ReleaseState.values())\n        .anyMatch(s -> s.name().equals(releaseState));\nif (!valid) { throw new IllegalArgumentException(\"releaseState must be ONLINE or OFFLINE\"); }","typeGuard":"ReleaseState parseReleaseState(String s) {\n    return s == null ? null : Arrays.stream(ReleaseState.values())\n        .filter(v -> v.name().equalsIgnoreCase(s)).findFirst().orElse(null);\n}","tryCatchPattern":"try {\n    taskDefinitionService.releaseTaskDefinition(loginUser, projectCode, code, state);\n} catch (ServiceException e) {\n    if (e.getCode() == 10001) { /* invalid RELEASE_STATE: fix client payload */ }\n    throw e;\n}","preventionTips":["Use the typed ReleaseState enum in clients instead of raw strings so nulls are caught at compile time.","Ensure the request body/query includes the releaseState field with exact enum casing.","Add a contract test asserting release requests always carry a non-null releaseState."],"tags":["validation","missing-parameter","release-state"],"backgroundTag":"missing-required-argument","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"}