apache/dolphinscheduler · error · ServiceException

REQUEST_PARAMS_NOT_VALID_ERROR

REQUEST_PARAMS_NOT_VALID_ERROR

Error message

Parameter releaseState is invalid.

What it means

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.

Source

Thrown at dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java:382

                        Collections.singletonList(taskDefinitionLog));
                String resourceIds = taskDefinition.getResourceIds();
                if (StringUtils.isNotBlank(resourceIds)) {
                    Integer[] resourceIdArray =
                            Arrays.stream(resourceIds.split(",")).map(Integer::parseInt).toArray(Integer[]::new);
                    PermissionCheck<Integer> permissionCheck = new PermissionCheck(AuthorizationType.RESOURCE_FILE_ID,
                            processService, resourceIdArray, loginUser.getId(), log);
                    try {
                        permissionCheck.checkPermission();
                    } catch (Exception e) {
                        log.error("Resources permission check error, resourceIds:{}.", resourceIds, e);
                        throw new ServiceException(Status.RESOURCE_NOT_EXIST_OR_NO_PERMISSION);
                    }
                }
                taskDefinition.setFlag(Flag.YES);
                taskDefinitionLog.setFlag(Flag.YES);
                break;
            default:
                log.warn("Parameter releaseState is invalid.");
                throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.RELEASE_STATE);
        }
        boolean updateSuccess = taskDefinitionDao.updateById(taskDefinition);
        int updateLog = taskDefinitionLogMapper.updateById(taskDefinitionLog);
        if (updateSuccess != (updateLog == 1)) {
            log.error("Update taskDefinition state or taskDefinitionLog state error, taskDefinitionCode:{}.", code);
            throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR);
        }
        log.info("Update taskDefinition state or taskDefinitionLog state to complete, taskDefinitionCode:{}.",
                code);
    }

    @Override
    public void deleteTaskByWorkflowDefinitionCode(long workflowDefinitionCode, int workflowDefinitionVersion) {
        List<WorkflowTaskRelation> workflowTaskRelations = workflowTaskRelationService
                .queryByWorkflowDefinitionCode(workflowDefinitionCode, workflowDefinitionVersion);
        if (CollectionUtils.isEmpty(workflowTaskRelations)) {
            return;

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Send releaseState using the exact accepted value for ONLINE or OFFLINE as defined by the server enum.
  2. Inspect the task definition's current state first and only send a valid transition target.
  3. Fix client code that maps 'ONLINE'/'OFFLINE' strings to numeric codes incorrectly.
  4. Upgrade the UI/SDK if it predates the current release-state encoding.

Example fix

// before
await post('/task-definition/release', { code, version, releaseState: 'online' })
// after
import { ReleaseState } from '@/service/modules/task-definition'
await post('/task-definition/release', { code, version, releaseState: ReleaseState.ONLINE })
Defensive patterns

Strategy: validation

Validate before calling

const RELEASE_STATES = new Set([0, 1]) // ONLINE / OFFLINE per server enum
function canRelease(releaseState: unknown): releaseState is number {
  return typeof releaseState === 'number' && RELEASE_STATES.has(releaseState)
}

Type guard

function isReleaseState(v: unknown): v is 0 | 1 {
  return v === 0 || v === 1
}

Try / catch

try {
  await releaseTaskDefinition({ code, version, releaseState })
} catch (e) {
  if (isServiceException(e, 'REQUEST_PARAMS_NOT_VALID_ERROR')) {
    toast(`Invalid releaseState: ${releaseState}. Use the ReleaseState enum values.`)
  } else throw e
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/f0df0da81bdb549a. Report an issue: GitHub.