{"record":{"id":"5d8035a35e6ead2d","repo":"flowable/flowable-engine","slug":"form-engine-is-not-initialized-5d8035","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-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/CompleteTaskWithFormCmd.java","lineNumber":118,"sourceCode":"    }\n    \n    public CompleteTaskWithFormCmd(String taskId, String formDefinitionId, String outcome, String userId,\n            Map<String,Object> variables, Map<String, Object> variablesLocal, Map<String, Object> transientVariables, \n            Map<String, Object> transientVariablesLocal) {\n        \n        this(taskId, formDefinitionId, outcome, variables, variablesLocal, transientVariables, transientVariablesLocal);\n        this.userId = userId;\n    }\n\n    @Override\n    protected Void execute(CommandContext commandContext, TaskEntity task) {\n        if (StringUtils.isNotEmpty(task.getProcessInstanceId())) {\n            throw new FlowableException(task + \" is created by the process engine and should be completed via the process engine API\");\n        }\n        \n        FormService formService = CommandContextUtil.getFormService(commandContext);\n        if (formService == null) {\n            throw new FlowableIllegalArgumentException(\"Form engine is not initialized\");\n        }\n\n        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n        FormRepositoryService formRepositoryService = CommandContextUtil.getFormRepositoryService(commandContext);\n        FormInfo formInfo = formRepositoryService.getFormModelById(formDefinitionId);\n\n        if (formInfo != null) {\n            // validate input at first\n            FormFieldHandler formFieldHandler = cmmnEngineConfiguration.getFormFieldHandler();\n            if (isFormFieldValidationEnabled(task)) {\n                formService.validateFormFields(task.getTaskDefinitionKey(), \"humanTask\", task.getScopeId(), \n                        task.getScopeDefinitionId(), ScopeTypes.CMMN, formInfo, variables);\n            }\n            // Extract raw variables and complete the task\n            Map<String, Object> taskVariables = formService.getVariablesFromFormSubmission(task.getTaskDefinitionKey(), \"humanTask\", task.getScopeId(), \n                    task.getScopeDefinitionId(), ScopeTypes.CMMN, formInfo, variables, outcome);\n\n            // The taskVariables are the variables that should be used when completing the task","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/CompleteTaskWithFormCmd.java#L100-L136","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Add the flowable-form-engine dependency (or flowable-spring-boot-starter-process/cmmn with form support) to the application.","Register the form engine configurator, e.g. cmmnEngineConfiguration.addConfigurator(new FormEngineConfigurator()) so the form service is available.","If forms are not needed, use plain completeTask instead of completeTaskWithForm."],"exampleFix":"// before\nCmmnEngineConfiguration cfg = new StandaloneCmmnEngineConfiguration(); // no form engine\n// after\ncfg.addConfigurator(new org.flowable.form.engine.configurator.FormEngineConfigurator());","handlingStrategy":"fallback","validationCode":"boolean formsEnabled = applicationContext.getBean(CmmnEngineConfiguration.class)\n    .getCommandInvoker().getAbstractCommandInterceptor() != null && isFormEngineConfigured();\nif (!formsEnabled) {\n    cmmnTaskService.completeTask(taskId, variables); // skip form flow\n}","typeGuard":null,"tryCatchPattern":"try {\n    cmmnTaskService.completeTaskWithForm(taskId, formId, outcome, vars);\n} catch (FlowableIllegalArgumentException e) {\n    if (\"Form engine is not initialized\".equals(e.getMessage())) {\n        cmmnTaskService.completeTask(taskId, vars); // fallback to plain completion\n    } else {\n        throw e;\n    }\n}","preventionTips":["Include the flowable-form-engine dependency whenever completeTaskWithForm is used.","Register the FormEngineConfigurator in custom CmmnEngineConfiguration setups.","Add an integration test that performs a form completion at boot time."],"tags":["cmmn","form-engine","missing-dependency","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-14T11:17:12.474Z"}