{"record":{"id":"686e471f7bf47a2c","repo":"flowable/flowable-engine","slug":"form-engine-is-not-initialized-686e47","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/CompleteTaskWithFormCmd.java","lineNumber":115,"sourceCode":"    }\n    \n    public CompleteTaskWithFormCmd(String taskId, String formDefinitionId, String outcome, String userId, \n            Map<String, Object> variables, Map<String, Object> variablesLocal, \n            Map<String, Object> transientVariables, 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.getScopeId()) && ScopeTypes.CMMN.equals(task.getScopeType())) {\n            throw new FlowableException(\"The \" + task + \" is created by the cmmn engine and should be completed via the cmmn engine API\");\n        }\n        \n        FormService formService = CommandContextUtil.getFormService();\n        if (formService == null) {\n            throw new FlowableIllegalArgumentException(\"Form engine is not initialized\");\n        }\n\n        FormRepositoryService formRepositoryService = CommandContextUtil.getFormRepositoryService();\n        FormInfo formInfo = formRepositoryService.getFormModelById(formDefinitionId);\n\n        Map<String, Object> formVariables;\n        boolean local = variablesLocal != null && !variablesLocal.isEmpty();\n        if (local) {\n            formVariables = variablesLocal;\n        } else {\n            formVariables = variables;\n        }\n        Map<String, Object> taskVariables = null;\n\n        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);\n        if (formInfo != null) {\n            FormFieldHandler formFieldHandler = processEngineConfiguration.getFormFieldHandler();\n            if (isFormFieldValidationEnabled(task, processEngineConfiguration, task.getProcessDefinitionId(), task.getTaskDefinitionKey())) {","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/CompleteTaskWithFormCmd.java#L97-L133","documentation":"CompleteTaskWithFormCmd requires the Flowable form engine to resolve the form model by its definition id. If no FormService is registered in the process engine configuration, the command cannot proceed and throws FlowableIllegalArgumentException. This means the form engine was never added to the configuration.","triggerScenarios":"Calling completeTaskWithForm on a runtime whose ProcessEngineConfiguration lacks a FormService (form engine dependency absent or formEngineConfiguration not initialized); CommandContextUtil.getFormService() returns null in the command context.","commonSituations":"Deploying flowable-engine without the flowable-form-engine module on the classpath; building a custom/stripped ProcessEngineConfiguration that omits form engine init; embedding Flowable in an app where only the core process engine is configured.","solutions":["Add the flowable-form-engine dependency and ensure the form engine is configured: use SpringProcessEngineConfiguration (or StandaloneProcessEngineConfiguration) with formEngineConfiguration set / ProcessEngineConfigurator for forms registered.","Verify ProcessEngineConfigurationImpl.getFormService() (via getFormEngineConfiguration) is non-null at startup; fail fast in an init check.","Avoid completeTaskWithForm if forms are unused; use plain taskService.complete(taskId, variables)."],"exampleFix":"// before (custom config, no form engine)\nProcessEngineConfiguration cfg = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();\n// after\nSpringProcessEngineConfiguration cfg = new SpringProcessEngineConfiguration();\ncfg.setFormEngineConfiguration(formEngineConfiguration); // or add the form engine configurator","handlingStrategy":"validation","validationCode":"if (processEngine == null || ((ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration()).getFormService() == null) {\n    throw new IllegalStateException(\"Form engine not configured\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    taskService.completeTaskWithForm(taskId, formId, outcome, vars);\n} catch (FlowableIllegalArgumentException e) {\n    log.error(\"Form engine missing; falling back to plain complete\", e);\n    taskService.complete(taskId, vars);\n}","preventionTips":["Add flowable-form-engine to dependencies and register the form engine configurator in engine config","Add a startup health check that asserts FormService is available when forms are used","Avoid stripped custom ProcessEngineConfigurations unless you know which services you need"],"tags":["flowable","form-engine","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"}