{"record":{"id":"3e2a67e36ac064f9","repo":"flowable/flowable-engine","slug":"cmmn-bytes-is-null","errorCode":null,"errorMessage":"cmmn bytes is null","messagePattern":"cmmn bytes is null","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CmmnDeploymentBuilderImpl.java","lineNumber":135,"sourceCode":"                if (!entry.isDirectory()) {\n                    String entryName = entry.getName();\n                    byte[] bytes = IoUtil.readInputStream(zipInputStream, entryName);\n                    CmmnResourceEntity resource = resourceEntityManager.create();\n                    resource.setName(entryName);\n                    resource.setBytes(bytes);\n                    deployment.addResource(resource);\n                }\n                entry = zipInputStream.getNextEntry();\n            }\n        } catch (Exception e) {\n            throw new FlowableException(\"problem reading zip input stream\", e);\n        }\n        return this;\n    }\n\n    public CmmnDeploymentBuilder addCmmnBytes(String resourceName, byte[] cmmnBytes) {\n        if (cmmnBytes == null) {\n            throw new FlowableException(\"cmmn bytes is null\");\n        }\n\n        CmmnResourceEntity resource = resourceEntityManager.create();\n        resource.setName(resourceName);\n        resource.setBytes(cmmnBytes);\n        deployment.addResource(resource);\n        return this;\n    }\n\n    public CmmnDeploymentBuilder addCmmnModel(String resourceName, CmmnModel cmmnModel) {\n        // TODO\n        return null;\n    }\n\n    @Override\n    public CmmnDeploymentBuilder name(String name) {\n        deployment.setName(name);\n        return this;","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/repository/CmmnDeploymentBuilderImpl.java#L117-L153","documentation":"FlowableException thrown by the helper addCmmnBytes when the cmmnBytes parameter is null. Like addBytes, the resource entity requires actual byte content for the CMMN model, so null is rejected immediately.","triggerScenarios":"Calling addCmmnBytes(resourceName, null), typically when the CMMN XML was serialized to bytes by a step that returned null or the byte[] variable was never initialized.","commonSituations":"Model-to-bytes conversion returning null on failure, uninitialized fields in generated deployment code, test fixtures missing binary content.","solutions":["Ensure the byte[] is non-null before calling addCmmnBytes","Check the producer of the bytes for silent null returns","Fail early with your own descriptive validation before invoking the builder"],"exampleFix":"// before\nbuilder.addCmmnBytes(\"model.cmmn.xml\", cmmnBytes); // may be null\n// after\nif (cmmnBytes == null || cmmnBytes.length == 0) { throw new IllegalStateException(\"CMMN bytes missing\"); }\nbuilder.addCmmnBytes(\"model.cmmn.xml\", cmmnBytes);","handlingStrategy":"validation","validationCode":"if (cmmnBytes == null || cmmnBytes.length == 0) { throw new IllegalArgumentException(\"CMMN bytes must be non-empty\"); }","typeGuard":"static boolean hasCmmnContent(byte[] b) { return b != null && b.length > 0; }","tryCatchPattern":"try {\n    builder.addCmmnBytes(resourceName, cmmnBytes);\n} catch (FlowableException e) {\n    if (\"cmmn bytes is null\".equals(e.getMessage())) {\n        throw new IllegalArgumentException(\"CMMN model bytes missing for \" + resourceName, e);\n    }\n    throw e;\n}","preventionTips":["Initialize byte[] fields at construction or make them method-returned, never nullable defaults","Have converters throw on failure instead of returning null","Validate content presence before building deployments in tests","Prefer addClasspathResource/addInputStream for static models to avoid manual byte handling"],"tags":["null-check","argument-validation","deployment","cmmn"],"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"}