{"record":{"id":"a633b8f245363fdf","repo":"flowable/flowable-engine","slug":"form-engine-is-not-initialized-a633b8","errorCode":null,"errorMessage":"Form engine is not initialized","messagePattern":"Form engine is not initialized","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetTaskFormModelCmd.java","lineNumber":60,"sourceCode":"\n    private static final long serialVersionUID = 1L;\n\n    protected String taskId;\n    protected boolean ignoreVariables;\n\n    public GetTaskFormModelCmd(String taskId, boolean ignoreVariables) {\n        this.taskId = taskId;\n        this.ignoreVariables = ignoreVariables;\n    }\n\n    @Override\n    public FormInfo execute(CommandContext commandContext) {\n        boolean historic = false;\n\n        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\n        FormService formService = CommandContextUtil.getFormService();\n        if (formService == null) {\n            throw new FlowableIllegalArgumentException(\"Form engine is not initialized\");\n        }\n\n        TaskInfo task = processEngineConfiguration.getTaskServiceConfiguration().getTaskService().getTask(taskId);\n        Date endTime = null;\n        if (task == null) {\n            historic = true;\n            task = processEngineConfiguration.getTaskServiceConfiguration().getHistoricTaskService().getHistoricTask(taskId);\n            if (task != null) {\n                endTime = ((HistoricTaskInstance) task).getEndTime();\n            }\n        }\n\n        if (task == null) {\n            throw new FlowableObjectNotFoundException(\"Task not found with id \" + taskId);\n        }\n\n        Map<String, Object> variables = new HashMap<>();\n        if (!ignoreVariables && task.getProcessInstanceId() != null) {","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetTaskFormModelCmd.java#L42-L78","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add the flowable-form-engine dependency (or flowable-spring-boot-starter-process which includes it) so the FormEngineConfigurator is applied","Verify ProcessEngineConfiguration includes the form engine configurator / formService is wired","If the form engine is intentionally not used, stop calling getTaskFormModel and rely on formKey-based rendering instead"],"exampleFix":"// before\nProcessEngineConfiguration cfg = ProcessEngineConfiguration\n    .createStandaloneProcessEngineConfiguration(); // no form engine\n// after\nProcessEngineConfiguration cfg = ProcessEngineConfiguration\n    .createStandaloneProcessEngineConfiguration();\n// ensure flowable-form-engine on classpath; or check availability:\nif (formService != null) {\n    FormInfo info = taskService.getTaskFormModel(taskId);\n}","handlingStrategy":"fallback","validationCode":"// Verify the form engine is wired before calling form-model APIs\nboolean formEngineAvailable = processEngine != null\n    && processEngine.getProcessEngineConfiguration() instanceof ProcessEngineConfigurationImpl\n    && ((ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration())\n        .getFormService() != null;","typeGuard":null,"tryCatchPattern":"try {\n    FormInfo info = taskService.getTaskFormModel(taskId);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"Form engine is not initialized\")) {\n        // fall back to formKey-based rendering\n        info = null;\n    } else {\n        throw e;\n    }\n}","preventionTips":["Include flowable-form-engine (or the full Spring Boot starter) when using form-model APIs","Confirm the FormEngineConfigurator runs during engine bootstrap","If the form engine is deliberately absent, gate getTaskFormModel calls behind a feature check"],"tags":["java","flowable","form-engine","configuration","initialization"],"backgroundTag":"missing-dependency","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}