flowable/flowable-engine · error · FlowableIllegalArgumentException

Not both a taskId and a processDefinitionId parameter can…

Error message

Not both a taskId and a processDefinitionId parameter can be provided

What it means

FormDataResource.getFormData treats taskId and processDefinitionId as mutually exclusive: form data is fetched either for a task or for a process definition's start form. Supplying both query parameters simultaneously throws FlowableIllegalArgumentException to avoid ambiguous lookup.

Solutions

  1. Send only taskId when looking up a task's form data; drop processDefinitionId.
  2. Send only processDefinitionId when fetching the start form; drop taskId.
  3. Add client-side mutual-exclusion validation before building the URL.
  4. If you need both pieces of data, issue two separate requests.

Example fix

// before
GET /form/form-data?taskId=125&processDefinitionId=oneTaskProcess:1:4
// after
GET /form/form-data?taskId=125
Defensive patterns

Strategy: validation

Validate before calling

if (taskId != null && processDefinitionId != null) {
    throw new IllegalArgumentException("Send only one of taskId or processDefinitionId");
}

Try / catch

try { formData = api.getFormData(taskId, null); } catch (FlowableIllegalArgumentException e) { /* strip the redundant parameter and retry */ }

Prevention

When it happens

Trigger: GET /form/form-data?taskId=X&processDefinitionId=Y — both parameters non-null in the same request, usually from a client that blindly forwards all known ids.

Common situations: Query-builder code that appends every available id, copies of URLs shared between the two lookup modes, or gateway/proxy layers enriching requests with extra parameters.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/b9cc7ce9e0b42d0f. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/form/FormDataResource.java:73

    protected FormService formService;
    
    @Autowired(required=false)
    protected BpmnRestApiInterceptor restApiInterceptor;

    @ApiOperation(value = "Get form data", tags = { "Forms" }, notes = "")
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "Indicates that form data could be queried."),
            @ApiResponse(code = 404, message = "Indicates that form data could not be found.") })
    @GetMapping(value = "/form/form-data", produces = "application/json")
    public FormDataResponse getFormData(@RequestParam(value = "taskId", required = false) String taskId,
            @RequestParam(value = "processDefinitionId", required = false) String processDefinitionId) {

        if (taskId == null && processDefinitionId == null) {
            throw new FlowableIllegalArgumentException("The taskId or processDefinitionId parameter has to be provided");
        }

        if (taskId != null && processDefinitionId != null) {
            throw new FlowableIllegalArgumentException("Not both a taskId and a processDefinitionId parameter can be provided");
        }

        FormData formData = null;
        String id = null;
        if (taskId != null) {
            formData = formService.getTaskFormData(taskId);
            id = taskId;
        } else {
            formData = formService.getStartFormData(processDefinitionId);
            id = processDefinitionId;
        }

        if (formData == null) {
            throw new FlowableObjectNotFoundException("Could not find a form data with id '" + id + "'.", FormData.class);
        }
        
        if (restApiInterceptor != null) {
            restApiInterceptor.accessFormData(formData);

View on GitHub (pinned to d6d39ce1c6)