flowable/flowable-engine · error · FlowableIllegalArgumentException

Invalid action, only 'execute' is supported.

Error message

Invalid action, only 'execute' is supported.

What it means

POST /management/jobs/{jobId} accepts an action request body, and only the action 'execute' is supported. FlowableIllegalArgumentException is thrown when the body is missing or the action field is anything else. This is an input-validation error, not a job state error.

Source

Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/management/JobResource.java:238

        try {
            managementService.deleteHistoryJob(jobId);
        } catch (FlowableObjectNotFoundException e) {
            // Re-throw to have consistent error-messaging across REST-api
            throw new FlowableObjectNotFoundException("Could not find a job with id '" + jobId + "'.", Job.class);
        }
    }

    @ApiOperation(value = "Execute a single job", tags = { "Jobs" }, code = 204)
    @ApiResponses(value = {
            @ApiResponse(code = 204, message = "Indicates the job was executed. Response-body is intentionally empty."),
            @ApiResponse(code = 404, message = "Indicates the requested job was not found."),
            @ApiResponse(code = 500, message = "Indicates the an exception occurred while executing the job. The status-description contains additional detail about the error. The full error-stacktrace can be fetched later on if needed.")
    })
    @PostMapping("/management/jobs/{jobId}")
    @ResponseStatus(HttpStatus.NO_CONTENT)
    public void executeJobAction(@ApiParam(name = "jobId") @PathVariable String jobId, @RequestBody RestActionRequest actionRequest) {
        if (actionRequest == null || !EXECUTE_ACTION.equals(actionRequest.getAction())) {
            throw new FlowableIllegalArgumentException("Invalid action, only 'execute' is supported.");
        }
        
        Job job = getJobById(jobId);

        try {
            managementService.executeJob(job.getId());
        } catch (FlowableObjectNotFoundException e) {
            // Re-throw to have consistent error-messaging across REST-api
            throw new FlowableObjectNotFoundException("Could not find a job with id '" + jobId + "'.", Job.class);
        }
    }

    @ApiOperation(value = "Execute a history job", tags = { "Jobs" }, code = 204)
    @ApiResponses(value = {
        @ApiResponse(code = 204, message = "Indicates the job was executed. Response-body is intentionally empty."),
        @ApiResponse(code = 404, message = "Indicates the requested job was not found."),
        @ApiResponse(code = 500, message = "Indicates the an exception occurred while executing the job. The status-description contains additional detail about the error. The full error-stacktrace can be fetched later on if needed.")
    })

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Send a JSON body with exactly {"action":"execute"}
  2. Set Content-Type: application/json header so the request body is deserialized
  3. For moving/rescheduling a timer job, use POST /management/timer-jobs/{jobId} with action 'move' or 'reschedule'

Example fix

// before
{"action": "reschedule"} -> POST /management/jobs/{jobId}  // 400
// after
{"action": "execute"} -> POST /management/jobs/{jobId}
Defensive patterns

Strategy: validation

Validate before calling

RestActionRequest req = new RestActionRequest();
req.setAction("execute");
if (!"execute".equals(req.getAction())) throw new IllegalArgumentException("action must be 'execute'");

Try / catch

try {
    restTemplate.postForLocation("/management/jobs/{id}", new RestActionRequest("execute"), jobId);
} catch (HttpClientErrorException.BadRequest e) {
    // invalid action payload
}

Prevention

When it happens

Trigger: POSTing to /management/jobs/{jobId} with a body like {"action":"move"} or {"action":"reschedule"} (unsupported on this endpoint — those belong to timer jobs), an empty body, or a missing/null action field.

Common situations: Copy-pasting timer-job action payloads (move/reschedule) onto the plain job endpoint; omitting Content-Type: application/json so the body deserializes to null; typos like "Execute" or "EXECUTE" (comparison is case-sensitive).

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 flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/6319a00e47b70c31. Report an issue: GitHub.