flowable/flowable-engine · error · FlowableIllegalArgumentException

Form engine is not initialized

Error message

Form engine is not initialized

What it means

GetTaskFormModelCmd throws FlowableIllegalArgumentException when the FormService lookup in the command context is null. The task form model cannot be retrieved without the form engine being initialized.

Solutions

  1. Add flowable-form-engine and initialize/register the form engine with the CMMN engine configuration
  2. Use the Spring Boot starters (flowable-spring-boot-starter-cmmn or -app) that auto-wire the form service
  3. In manual setups, ensure the form engine configuration is added to the engine configuration chain so getFormService() resolves
  4. Guard the call by checking the form service availability first

Example fix

// before
CmmnEngineConfiguration cfg = CmmnEngineConfiguration.createStandaloneConfig();
cfg.buildEngine(); // no form engine => getTaskFormModel throws
// after
CmmnEngineConfiguration cfg = CmmnEngineConfiguration.createStandaloneConfig();
cfg.addEngineConfiguration(formEngineConfiguration);
cfg.buildEngine();
Defensive patterns

Strategy: validation

Validate before calling

if (cmmnEngineConfiguration == null || CommandContextUtil.getFormService() == null) {
    throw new IllegalStateException("Form engine not initialized");
}

Try / catch

try {
    FormInfo info = cmmnTaskService.getTaskFormModel(taskId);
} catch (FlowableIllegalArgumentException e) {
    if ("Form engine is not initialized".equals(e.getMessage())) {
        // initialize form engine or disable form-model UI
    }
}

Prevention

When it happens

Trigger: Calling cmmnTaskService.getTaskFormModel(taskId) (or the CMMN task form REST endpoints) with a CMMN engine that was built without the form engine/service registered.

Common situations: Standalone CMMN engine deployment without flowable-form-engine; custom CommandContextUtil/engine configuration that never sets the FormService; missing form engine starter in Spring Boot apps.

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/4d92748fcbd2fa67. Report an issue: GitHub.

Appendix: source

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

 * @author Tijs Rademakers
 */
public class GetTaskFormModelCmd implements Command<FormInfo>, Serializable {

    private static final long serialVersionUID = 1L;

    protected String taskId;
    protected boolean ignoreVariables;

    public GetTaskFormModelCmd(String taskId, boolean ignoreVariables) {
        this.taskId = taskId;
        this.ignoreVariables = ignoreVariables;
    }

    @Override
    public FormInfo execute(CommandContext commandContext) {
        FormService formService = CommandContextUtil.getFormService();
        if (formService == null) {
            throw new FlowableIllegalArgumentException("Form engine is not initialized");
        }

        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
        TaskInfo task = cmmnEngineConfiguration.getTaskServiceConfiguration().getTaskService().getTask(taskId);
        Date endTime = null;
        if (task == null) {
            task = cmmnEngineConfiguration.getTaskServiceConfiguration().getHistoricTaskService().getHistoricTask(taskId);
            if (task != null) {
                endTime = ((HistoricTaskInstance) task).getEndTime();
            }
        }
        
        if (task == null) {
            throw new FlowableObjectNotFoundException("Task not found with id " + taskId);
        }

        Map<String, Object> variables = new HashMap<>();
        if (!ignoreVariables && task.getScopeId() != null) {

View on GitHub (pinned to d6d39ce1c6)