{"record":{"id":"01a7ec369a346f42","repo":"flowable/flowable-engine","slug":"deployment-doesn-t-contain-any-rules","errorCode":null,"errorMessage":"deployment  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/rules/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/rules/RulesHelper.java#L23-L47","documentation":"After loading (and, if needed, deploying) the deployment, RulesHelper re-checks the KieBase cache; if no knowledge base was produced, it concludes the deployment contains no rule resources (.drl/.bpmn with rules) and throws FlowableException. The deployment exists but has nothing usable as a KieBase.","triggerScenarios":"Calling findKnowledgeBaseByDeploymentId on a deployment that contains only BPMN/XML/other resources but no drools rule artifacts; rule resources failed to compile into a KieBase during deploy; deploying a deployment entity without rules in a rules-using flow.","commonSituations":"Reusing a plain process deployment id where a rules deployment id is expected; archive missing .drl files; older Flowable versions where rules support requires the flowable-drools integration module and compatible artifacts.","solutions":["Ensure the deployment archive actually contains rule resources (.drl files) when it was created.","Check the engine has the drools/rules integration configured (KnowledgeBaseBuilder deployed correctly).","Inspect the deployment resources via repositoryService.getDeploymentResourceNames(deploymentId) to confirm what was deployed.","Redeploy a dedicated rules archive and use that deployment id."],"exampleFix":"// before\nKieBase kb = RulesHelper.findKnowledgeBaseByDeploymentId(processDeploymentId); // no rules inside\n// after\nList<String> names = repositoryService.getDeploymentResourceNames(deploymentId);\nif (names.stream().noneMatch(n -> n.endsWith(\".drl\"))) {\n    throw new IllegalStateException(\"Deployment has no rules: \" + deploymentId);\n}\nKieBase kb = RulesHelper.findKnowledgeBaseByDeploymentId(deploymentId);","handlingStrategy":"validation","validationCode":"boolean deploymentHasRules(String deploymentId) {\n    return repositoryService.getDeploymentResourceNames(deploymentId).stream()\n        .anyMatch(n -> n.endsWith(\".drl\"));\n}","typeGuard":null,"tryCatchPattern":"try {\n    return RulesHelper.findKnowledgeBaseByDeploymentId(deploymentId);\n} catch (FlowableException e) {\n    if (e.getMessage().contains(\"doesn't contain any rules\")) {\n        throw new MissingRulesException(deploymentId, e);\n    }\n    throw e;\n}","preventionTips":["Deploy rules into a dedicated archive containing .drl files.","Verify deployed resource names include rule artifacts before using the rules helper.","Confirm the drools/rules integration module is on the classpath and configured.","Do not reuse plain process-deployment ids for rules lookups."],"tags":["java","flowable","rules","drools","deployment","empty-content"],"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"}