{"record":{"id":"4d92748fcbd2fa67","repo":"flowable/flowable-engine","slug":"form-engine-is-not-initialized-4d9274","errorCode":null,"errorMessage":"Form engine is not initialized","messagePattern":"Form engine is not initialized","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetTaskFormModelCmd.java","lineNumber":58,"sourceCode":" * @author Tijs Rademakers\n */\npublic class GetTaskFormModelCmd implements Command<FormInfo>, Serializable {\n\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        FormService formService = CommandContextUtil.getFormService();\n        if (formService == null) {\n            throw new FlowableIllegalArgumentException(\"Form engine is not initialized\");\n        }\n\n        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n        TaskInfo task = cmmnEngineConfiguration.getTaskServiceConfiguration().getTaskService().getTask(taskId);\n        Date endTime = null;\n        if (task == null) {\n            task = cmmnEngineConfiguration.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.getScopeId() != null) {","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetTaskFormModelCmd.java#L40-L76","documentation":"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.","triggerScenarios":"Calling cmmnTaskService.getTaskFormModel(taskId) (or the CMMN task form REST endpoints) with a CMMN engine that was built without the form engine/service registered.","commonSituations":"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.","solutions":["Add flowable-form-engine and initialize/register the form engine with the CMMN engine configuration","Use the Spring Boot starters (flowable-spring-boot-starter-cmmn or -app) that auto-wire the form service","In manual setups, ensure the form engine configuration is added to the engine configuration chain so getFormService() resolves","Guard the call by checking the form service availability first"],"exampleFix":"// before\nCmmnEngineConfiguration cfg = CmmnEngineConfiguration.createStandaloneConfig();\ncfg.buildEngine(); // no form engine => getTaskFormModel throws\n// after\nCmmnEngineConfiguration cfg = CmmnEngineConfiguration.createStandaloneConfig();\ncfg.addEngineConfiguration(formEngineConfiguration);\ncfg.buildEngine();","handlingStrategy":"validation","validationCode":"if (cmmnEngineConfiguration == null || CommandContextUtil.getFormService() == null) {\n    throw new IllegalStateException(\"Form engine not initialized\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    FormInfo info = cmmnTaskService.getTaskFormModel(taskId);\n} catch (FlowableIllegalArgumentException e) {\n    if (\"Form engine is not initialized\".equals(e.getMessage())) {\n        // initialize form engine or disable form-model UI\n    }\n}","preventionTips":["Bundle flowable-form-engine with the CMMN engine in every environment","Use starters/auto-configuration rather than manual engine assembly","Smoke-test form model retrieval at startup"],"tags":["cmmn","forms","configuration"],"backgroundTag":"missing-dependency","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}