{"record":{"id":"9fcd0d0ece33abd3","repo":"flowable/flowable-engine","slug":"event-definition-bytes-is-null","errorCode":null,"errorMessage":"event definition bytes is null","messagePattern":"event definition bytes is null","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/repository/EventDeploymentBuilderImpl.java","lineNumber":104,"sourceCode":"    }\n\n    @Override\n    public EventDeploymentBuilder addString(String resourceName, String text) {\n        if (text == null) {\n            throw new FlowableException(\"text is null\");\n        }\n\n        EventResourceEntity resource = resourceEntityManager.create();\n        resource.setName(resourceName);\n        resource.setBytes(text.getBytes(StandardCharsets.UTF_8));\n        deployment.addResource(resource);\n        return this;\n    }\n\n    @Override\n    public EventDeploymentBuilder addEventDefinitionBytes(String resourceName, byte[] eventDefinitionBytes) {\n        if (eventDefinitionBytes == null) {\n            throw new FlowableException(\"event definition bytes is null\");\n        }\n\n        EventResourceEntity resource = resourceEntityManager.create();\n        resource.setName(resourceName);\n        resource.setBytes(eventDefinitionBytes);\n        deployment.addResource(resource);\n        return this;\n    }\n\n    @Override\n    public EventDeploymentBuilder addEventDefinition(String resourceName, String eventDefinition) {\n        addString(resourceName, eventDefinition);\n        return this;\n    }\n    \n    @Override\n    public EventDeploymentBuilder addChannelDefinitionBytes(String resourceName, byte[] channelDefinitionBytes) {\n        if (channelDefinitionBytes == null) {","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-event-registry/src/main/java/org/flowable/eventregistry/impl/repository/EventDeploymentBuilderImpl.java#L86-L122","documentation":"FlowableException thrown by EventDeploymentBuilderImpl.addEventDefinitionBytes when the byte[] argument is null. The bytes become an EventResourceEntity added to the deployment, and a null payload is rejected upfront.","triggerScenarios":"Calling deploymentBuilder.addEventDefinitionBytes(resourceName, null); e.g. bytes read from a file that failed to load or a cache miss returning null.","commonSituations":"Reading event definition JSON/XML files at startup where the file read silently returned null; deserialization utilities returning null on failure.","solutions":["Verify the byte[] is non-null (and non-empty) before calling addEventDefinitionBytes.","Check that the file/stream that produced the bytes was read successfully.","Use addEventDefinition(String) for classpath-loaded definitions to let Flowable handle loading."],"exampleFix":"// before\nbyte[] bytes = loadBytes(\"order.event.json\"); // may be null\nbuilder.addEventDefinitionBytes(\"order.event.json\", bytes);\n// after\nbyte[] bytes = loadBytes(\"order.event.json\");\nif (bytes == null || bytes.length == 0) {\n    throw new IllegalStateException(\"order.event.json failed to load\");\n}\nbuilder.addEventDefinitionBytes(\"order.event.json\", bytes);","handlingStrategy":"validation","validationCode":"if (bytes == null || bytes.length == 0) { throw new IllegalArgumentException(\"event definition bytes must be non-empty\"); }","typeGuard":"boolean ok = bytes != null && bytes.length > 0;","tryCatchPattern":"try { builder.addEventDefinitionBytes(name, bytes); } catch (FlowableException e) { LOG.error(\"null event definition bytes\"); throw e; }","preventionTips":["Verify file reads return non-null bytes before deploying","Cache loaded definitions defensively with explicit null checks","Prefer addEventDefinition(String) for classpath resources"],"tags":["flowable","deployment","null-check","validation"],"backgroundTag":"null-argument","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"}