{"record":{"id":"9f7f865101f805c4","repo":"flowable/flowable-engine","slug":"form-engine-is-not-initialized-9f7f86","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/GetStartFormModelCmd.java","lineNumber":55,"sourceCode":" */\npublic class GetStartFormModelCmd implements Command<FormInfo>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n\n    protected String caseDefinitionId;\n    protected String caseInstanceId;\n\n    public GetStartFormModelCmd(String caseDefinitionId, String caseInstanceId) {\n        this.caseDefinitionId = caseDefinitionId;\n        this.caseInstanceId = caseInstanceId;\n    }\n\n    @Override\n    public FormInfo execute(CommandContext commandContext) {\n        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);\n        FormService formService = CommandContextUtil.getFormService(commandContext);\n        if (formService == null) {\n            throw new FlowableIllegalArgumentException(\"Form engine is not initialized\");\n        }\n\n        FormInfo formInfo = null;\n        CaseDefinition caseDefinition = CaseDefinitionUtil.getCaseDefinition(caseDefinitionId);\n        CmmnModel cmmnModel = CaseDefinitionUtil.getCmmnModel(caseDefinitionId);\n        Case caseModel = cmmnModel.getCaseById(caseDefinition.getKey());\n        Stage planModel = caseModel.getPlanModel();\n\n        if (StringUtils.isNotEmpty(planModel.getFormKey())) {\n            CmmnDeployment deployment = CommandContextUtil.getCmmnDeploymentEntityManager(commandContext).findById(caseDefinition.getDeploymentId());\n            formInfo = formService.getFormInstanceModelByKeyAndParentDeploymentIdAndScopeId(planModel.getFormKey(), deployment.getParentDeploymentId(), \n                            caseInstanceId, ScopeTypes.CMMN, null, caseDefinition.getTenantId(), cmmnEngineConfiguration.isFallbackToDefaultTenant());\n        }\n\n        // If form does not exists, we don't want to leak out this info to just anyone\n        if (formInfo == null) {\n            throw new FlowableObjectNotFoundException(\"Form model for case definition \" + caseDefinitionId + \" cannot be found\");\n        }","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetStartFormModelCmd.java#L37-L73","documentation":"GetStartFormModelCmd requires the form engine to be wired into the CMMN engine configuration. When CommandContextUtil.getFormService(commandContext) returns null, the command throws FlowableIllegalArgumentException because it cannot resolve form models without it.","triggerScenarios":"Calling cmmnRuntimeService.getStartFormModel(caseDefinitionId, caseInstanceId) in an engine setup where the form engine (flowable-form-engine / FormService) was never registered, e.g. a standalone CmmnEngineConfiguration without the form resource accelerator or form engine configuration.","commonSituations":"Bootstrapping only the CMMN engine without flowable-form-engine on the classpath or without deploying the form engine alongside; building a custom engine configuration that omits the form service; Spring configuration missing the FormEngine beans.","solutions":["Add the flowable-form-engine dependency and initialize the form engine (SpringProcessEngineConfiguration-style auto wiring or ProcessEngineConfiguration with form engine resources)","Ensure the CmmnEngineConfiguration is created through a configuration that links the form service (e.g. via the app/engine integration rather than a bare CmmnEngineConfiguration)","In custom setups, register the FormService into the command context util / engine configurations","Verify getFormService() is non-null by checking engine configuration before calling getStartFormModel"],"exampleFix":"// before\nCmmnEngineConfiguration cfg = CmmnEngineConfiguration.createStandaloneConfig();\nCmmnEngine cmmnEngine = cfg.buildEngine();\n// after\nCmmnEngineConfiguration cfg = CmmnEngineConfiguration.createStandaloneConfig();\ncfg.setFormEngineConfiguration(formEngineConfiguration); // or use app-engine / spring boot starter which wires it\ncfg.addEngineConfiguration(formEngineConfiguration);\nCmmnEngine cmmnEngine = cfg.buildEngine();","handlingStrategy":"validation","validationCode":"if (formEngineConfiguration == null || cmmnEngineConfiguration.getFormService() == null) {\n    throw new IllegalStateException(\"Form engine must be initialized before retrieving start form models\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    FormInfo info = cmmnRuntimeService.getStartFormModel(caseDefId, caseInstanceId);\n} catch (FlowableIllegalArgumentException e) {\n    if (\"Form engine is not initialized\".equals(e.getMessage())) {\n        // boot form engine or degrade feature\n    }\n}","preventionTips":["Always deploy CMMN together with the form engine (use flowable-spring-boot-starter-cmmn/app)","Never build a bare CmmnEngineConfiguration if form features are needed","Add a startup health check that the FormService resolves in the command context"],"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"}