{"record":{"id":"ec43a0822e80d4f1","repo":"flowable/flowable-engine","slug":"deploymentid-is-null-ec43a0","errorCode":null,"errorMessage":"deploymentId is null","messagePattern":"deploymentId is null","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/cmd/GetDeploymentResourceCmd.java","lineNumber":43,"sourceCode":"\n/**\n * @author Joram Barrez\n */\npublic class GetDeploymentResourceCmd implements Command<InputStream>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    protected String deploymentId;\n    protected String resourceName;\n\n    public GetDeploymentResourceCmd(String deploymentId, String resourceName) {\n        this.deploymentId = deploymentId;\n        this.resourceName = resourceName;\n    }\n\n    @Override\n    public InputStream execute(CommandContext commandContext) {\n        if (deploymentId == null) {\n            throw new FlowableIllegalArgumentException(\"deploymentId is null\");\n        }\n        if (resourceName == null) {\n            throw new FlowableIllegalArgumentException(\"resourceName is null\");\n        }\n\n        DmnResourceEntity resource = CommandContextUtil.getResourceEntityManager().findResourceByDeploymentIdAndResourceName(deploymentId, resourceName);\n        if (resource == null) {\n            if (CommandContextUtil.getDeploymentEntityManager(commandContext).findById(deploymentId) == null) {\n                throw new FlowableObjectNotFoundException(\"deployment does not exist: \" + deploymentId);\n            } else {\n                throw new FlowableObjectNotFoundException(\"no resource found with name '\" + resourceName + \"' in deployment '\" + deploymentId + \"'\");\n            }\n        }\n        return new ByteArrayInputStream(resource.getBytes());\n    }\n\n}\n","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-dmn-engine/src/main/java/org/flowable/dmn/engine/impl/cmd/GetDeploymentResourceCmd.java#L25-L61","documentation":"GetDeploymentResourceCmd.execute validates that a deploymentId was supplied and throws FlowableIllegalArgumentException when it is null. The deployment id is required to look up resources in the DMN engine's resource entity manager, so a null value cannot be meaningfully queried.","triggerScenarios":"dmnRepositoryService.getDeploymentResource(null, resourceName) or building GetDeploymentResourceCmd without a deployment id — commonly the id is read from a Deployment object/variable that is null.","commonSituations":"Looking up the deployment id by name/key first and that lookup returned null; passing an entity's id before the entity was persisted; wiring error where a different variable is passed in the first argument slot.","solutions":["Pass the actual deployment id string from dmnRepositoryService.createDeploymentQuery()...singleResult().getId()","Check the preceding lookup that produced the id — if it returned null, handle that before calling getDeploymentResource","Ensure arguments are in the right order: getDeploymentResource(deploymentId, resourceName)"],"exampleFix":"// before\nDeployment d = repoService.createDeploymentQuery().deploymentName(name).singleResult();\nrepoService.getDeploymentResource(d.getId(), resource); // NPE/null id if d == null\n// after\nDeployment d = repoService.createDeploymentQuery().deploymentName(name).singleResult();\nif (d == null) throw new IllegalStateException(\"no deployment named \" + name);\nrepoService.getDeploymentResource(d.getId(), resource);","handlingStrategy":"validation","validationCode":"if (deploymentId == null || deploymentId.isEmpty()) throw new IllegalArgumentException(\"deploymentId is required\");","typeGuard":null,"tryCatchPattern":"try { repoService.getDeploymentResource(depId, name); } catch (FlowableIllegalArgumentException e) { if (e.getMessage().equals(\"deploymentId is null\")) { throw new ConfigurationException(\"deployment id missing\", e); } throw e; }","preventionTips":["Fetch deployment ids at runtime from deployment queries instead of storing them","Handle a null result from any query used to obtain the id before using it","Keep argument order (deploymentId, resourceName) consistent in wrapper methods"],"tags":["flowable","dmn","null-argument","deployment"],"backgroundTag":"null-argument","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"}