{"record":{"id":"67f0fb65ce88476f","repo":"flowable/flowable-engine","slug":"deploymentid-is-null-67f0fb","errorCode":null,"errorMessage":"deploymentId is null","messagePattern":"deploymentId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"warning","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetDeploymentResourceCmd.java","lineNumber":44,"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        ResourceEntity 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, Deployment.class);\n            } else {\n                throw new FlowableObjectNotFoundException(\"no resource found with name '\" + resourceName + \"' in deployment '\" + deploymentId + \"'\", InputStream.class);\n            }\n        }\n        return new ByteArrayInputStream(resource.getBytes());\n    }\n\n}\n","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetDeploymentResourceCmd.java#L26-L62","documentation":"FlowableIllegalArgumentException thrown by GetDeploymentResourceCmd.execute when deploymentId is null. The command fetches a resource byte stream from a deployment, which requires both a deployment id and a resource name. This is an immediate argument validation failure before any entity lookup.","triggerScenarios":"Calling repositoryService.getResource(deploymentId, resourceName) where deploymentId came from an uninitialized variable, a failed lookup that returned null, or a null column in your own data model.","commonSituations":"Chaining getResource after a query that returned no deployment (null id); deserializing ids from JSON where the field was absent; passing deployment name instead of id (null after lookup).","solutions":["Guard deploymentId for null before calling; fail with your own descriptive error.","Resolve a valid deploymentId via RepositoryService.createDeploymentQuery().deploymentKey(...).latest().singleResult().getId().","Catch FlowableIllegalArgumentException and map to a client input/validation error.","Check your data source: if the id came from a DB column or API payload, fix the missing value at that source."],"exampleFix":"// before\nrepositoryService.getResource(deployment.getId(), name);\n// after\nif (deploymentId == null) throw new IllegalArgumentException(\"deploymentId required\");\nrepositoryService.getResource(deploymentId, name);","handlingStrategy":"validation","validationCode":"if (deploymentId == null || deploymentId.isBlank())\n    throw new IllegalArgumentException(\"deploymentId is required\");","typeGuard":"Optional<String> requireDeploymentId(String id) {\n    return Optional.ofNullable(id).filter(s -> !s.isBlank());\n}","tryCatchPattern":"try {\n    return repositoryService.getResource(deploymentId, resourceName);\n} catch (FlowableIllegalArgumentException e) {\n    throw new BadRequestException(\"deploymentId is required and must not be null\", e);\n}","preventionTips":["Null-check deployment ids obtained from lookups before use.","Use @NotNull validation on API request fields carrying deploymentId.","Propagate Optional/nullable results explicitly instead of auto-unboxing nulls.","Add integration tests for resource fetch with missing ids."],"tags":["flowable","validation","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-14T05:17:10.506Z"}