{"record":{"id":"f87ba76a0f98e02f","repo":"flowable/flowable-engine","slug":"deployment-deploymentid-doesn-t-contain-any-rul","errorCode":null,"errorMessage":"deployment ${deploymentId} doesn't contain any rules","messagePattern":"deployment (.+?) doesn't contain any rules","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/app/RulesHelper.java","lineNumber":41,"sourceCode":"\n/**\n * @author Tom Baeyens\n */\npublic class RulesHelper {\n\n    public static KieBase findKnowledgeBaseByDeploymentId(String deploymentId) {\n        DeploymentCache<Object> knowledgeBaseCache = CommandContextUtil.getProcessEngineConfiguration().getDeploymentManager().getKnowledgeBaseCache();\n\n        KieBase knowledgeBase = (KieBase) knowledgeBaseCache.get(deploymentId);\n        if (knowledgeBase == null) {\n            DeploymentEntity deployment = CommandContextUtil.getDeploymentEntityManager().findById(deploymentId);\n            if (deployment == null) {\n                throw new FlowableObjectNotFoundException(\"no deployment with id \" + deploymentId, Deployment.class);\n            }\n            CommandContextUtil.getProcessEngineConfiguration().getDeploymentManager().deploy(deployment);\n            knowledgeBase = (KieBase) knowledgeBaseCache.get(deploymentId);\n            if (knowledgeBase == null) {\n                throw new FlowableException(\"deployment \" + deploymentId + \" doesn't contain any rules\");\n            }\n        }\n        return knowledgeBase;\n    }\n}\n","sourceCodeStart":23,"sourceCodeEnd":47,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/app/RulesHelper.java#L23-L47","documentation":"After finding a valid deployment and (re)deploying it via the DeploymentManager, RulesHelper reads the KieBase from the knowledge base cache. If it is still null, the deployment contained no rule artifacts, so no KieBase could be built. This is a content problem: the deployment exists but has no .drl/rules resources.","triggerScenarios":"findKnowledgeBaseByDeploymentId(deploymentId) where the deployment exists but contains no rules (no .drl files), so RulesDeployer never registered a knowledge base for it.","commonSituations":"Deploying a BPMN process that declares a rules task while forgetting to include the .drl resources in the same deployment; deploying only the process and expecting rules from an earlier deployment; rules file filtered out by a build/deploy script.","solutions":["Add the .drl rule resources to the same deployment as the process: repositoryService.createDeployment().addClasspathResource(\"rules/rules.drl\").deploy().","Verify the deployment actually contains rules: repositoryService.getDeploymentResourceNames(deploymentId) should list .drl files.","Ensure RulesDeployer is active in the process engine configuration (it is by default; custom deployers list may have removed it)."],"exampleFix":"// before\nrepositoryService.createDeployment()\n    .addClasspathResource(\"processes/orderProcess.bpmn20.xml\")\n    .deploy(); // no rules included\n// after\nrepositoryService.createDeployment()\n    .addClasspathResource(\"processes/orderProcess.bpmn20.xml\")\n    .addClasspathResource(\"rules/orderRules.drl\")\n    .deploy();","handlingStrategy":"validation","validationCode":"List<String> resources = repositoryService.getDeploymentResourceNames(deploymentId);\nboolean hasRules = resources.stream().anyMatch(n -> n.endsWith(\".drl\"));\nif (!hasRules) {\n    throw new IllegalStateException(\"Deployment has no rules (.drl) resources\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    KieBase kb = rulesHelper.findKnowledgeBaseByDeploymentId(deploymentId);\n} catch (FlowableException e) {\n    if (e.getMessage().contains(\"doesn't contain any rules\")) {\n        // redeploy with .drl resources included\n    } else {\n        throw e;\n    }\n}","preventionTips":["Always bundle .drl rule resources in the same deployment as the process using them","Verify deployment resource names include .drl files after deploying","Ensure RulesDeployer is enabled in the engine configuration"],"tags":["rules","drools","deployment","empty-deployment"],"backgroundTag":"empty-result-set","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"}