flowable/flowable-engine · error · FlowableIllegalArgumentException

Form engine is not initialized

Error message

Form engine is not initialized

What it means

Thrown by CompleteTaskWithFormCmd when the form service lookup via CommandContextUtil.getFormService(commandContext) returns null. The CMMN engine is configured without the form engine integration, so form-based completion cannot fetch or submit the form model.

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/CompleteTaskWithFormCmd.java:118

    }
    
    public CompleteTaskWithFormCmd(String taskId, String formDefinitionId, String outcome, String userId,
            Map<String,Object> variables, Map<String, Object> variablesLocal, Map<String, Object> transientVariables, 
            Map<String, Object> transientVariablesLocal) {
        
        this(taskId, formDefinitionId, outcome, variables, variablesLocal, transientVariables, transientVariablesLocal);
        this.userId = userId;
    }

    @Override
    protected Void execute(CommandContext commandContext, TaskEntity task) {
        if (StringUtils.isNotEmpty(task.getProcessInstanceId())) {
            throw new FlowableException(task + " is created by the process engine and should be completed via the process engine API");
        }
        
        FormService formService = CommandContextUtil.getFormService(commandContext);
        if (formService == null) {
            throw new FlowableIllegalArgumentException("Form engine is not initialized");
        }

        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
        FormRepositoryService formRepositoryService = CommandContextUtil.getFormRepositoryService(commandContext);
        FormInfo formInfo = formRepositoryService.getFormModelById(formDefinitionId);

        if (formInfo != null) {
            // validate input at first
            FormFieldHandler formFieldHandler = cmmnEngineConfiguration.getFormFieldHandler();
            if (isFormFieldValidationEnabled(task)) {
                formService.validateFormFields(task.getTaskDefinitionKey(), "humanTask", task.getScopeId(), 
                        task.getScopeDefinitionId(), ScopeTypes.CMMN, formInfo, variables);
            }
            // Extract raw variables and complete the task
            Map<String, Object> taskVariables = formService.getVariablesFromFormSubmission(task.getTaskDefinitionKey(), "humanTask", task.getScopeId(), 
                    task.getScopeDefinitionId(), ScopeTypes.CMMN, formInfo, variables, outcome);

            // The taskVariables are the variables that should be used when completing the task

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Add the flowable-form-engine dependency (or flowable-spring-boot-starter-process/cmmn with form support) to the application.
  2. Register the form engine configurator, e.g. cmmnEngineConfiguration.addConfigurator(new FormEngineConfigurator()) so the form service is available.
  3. If forms are not needed, use plain completeTask instead of completeTaskWithForm.

Example fix

// before
CmmnEngineConfiguration cfg = new StandaloneCmmnEngineConfiguration(); // no form engine
// after
cfg.addConfigurator(new org.flowable.form.engine.configurator.FormEngineConfigurator());
Defensive patterns

Strategy: fallback

Validate before calling

boolean formsEnabled = applicationContext.getBean(CmmnEngineConfiguration.class)
    .getCommandInvoker().getAbstractCommandInterceptor() != null && isFormEngineConfigured();
if (!formsEnabled) {
    cmmnTaskService.completeTask(taskId, variables); // skip form flow
}

Try / catch

try {
    cmmnTaskService.completeTaskWithForm(taskId, formId, outcome, vars);
} catch (FlowableIllegalArgumentException e) {
    if ("Form engine is not initialized".equals(e.getMessage())) {
        cmmnTaskService.completeTask(taskId, vars); // fallback to plain completion
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling completeTaskWithForm in a CMMN engine configuration where the flowable-form-engine module/dependency is absent or the form engine was not registered in the CmmnEngineConfiguration (formService not injected into the command context).

Common situations: Using flowable-cmmn-engine without flowable-form-engine on the classpath; building a custom CmmnEngineConfiguration that omits form engine configurators; Spring Boot app with the form starter excluded.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


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