flowable/flowable-engine · error · FlowableIllegalArgumentException

Form engine is not initialized

Error message

Form engine is not initialized

What it means

GetTaskFormModelCmd builds a FormInfo (form model) for a task and depends on the Flowable Form engine being wired into the process engine configuration. When CommandContextUtil.getFormService() returns null it throws FlowableIllegalArgumentException("Form engine is not initialized"), because form models cannot be resolved without it.

Source

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

    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) {
        boolean historic = false;

        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
        FormService formService = CommandContextUtil.getFormService();
        if (formService == null) {
            throw new FlowableIllegalArgumentException("Form engine is not initialized");
        }

        TaskInfo task = processEngineConfiguration.getTaskServiceConfiguration().getTaskService().getTask(taskId);
        Date endTime = null;
        if (task == null) {
            historic = true;
            task = processEngineConfiguration.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.getProcessInstanceId() != null) {

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Add the flowable-form-engine dependency (or flowable-spring-boot-starter-process which includes it) so the FormEngineConfigurator is applied
  2. Verify ProcessEngineConfiguration includes the form engine configurator / formService is wired
  3. If the form engine is intentionally not used, stop calling getTaskFormModel and rely on formKey-based rendering instead

Example fix

// before
ProcessEngineConfiguration cfg = ProcessEngineConfiguration
    .createStandaloneProcessEngineConfiguration(); // no form engine
// after
ProcessEngineConfiguration cfg = ProcessEngineConfiguration
    .createStandaloneProcessEngineConfiguration();
// ensure flowable-form-engine on classpath; or check availability:
if (formService != null) {
    FormInfo info = taskService.getTaskFormModel(taskId);
}
Defensive patterns

Strategy: fallback

Validate before calling

// Verify the form engine is wired before calling form-model APIs
boolean formEngineAvailable = processEngine != null
    && processEngine.getProcessEngineConfiguration() instanceof ProcessEngineConfigurationImpl
    && ((ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration())
        .getFormService() != null;

Try / catch

try {
    FormInfo info = taskService.getTaskFormModel(taskId);
} catch (FlowableIllegalArgumentException e) {
    if (e.getMessage().contains("Form engine is not initialized")) {
        // fall back to formKey-based rendering
        info = null;
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling taskService.getTaskFormModel(taskId) (or getTaskFormModel with variables) on a process engine configuration where the form-engine integration (flowable-form-engine / formServiceConfigurator) is absent or failed to register.

Common situations: Using flowable-engine without the flowable-form-engine dependency on the classpath; building a custom ProcessEngineConfiguration that omits the FormEngineConfigurator; a partial Spring Boot setup excluding form auto-configuration while still calling form-model APIs.

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