{"record":{"id":"f9b74576b6639839","repo":"flowable/flowable-engine","slug":"error-exporting-diagram","errorCode":null,"errorMessage":"Error exporting diagram","messagePattern":"Error exporting diagram","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/CaseInstanceDiagramResource.java","lineNumber":77,"sourceCode":"    })\n    @GetMapping(value = \"/cmmn-runtime/case-instances/{caseInstanceId}/diagram\")\n    public ResponseEntity<byte[]> getCaseInstanceDiagram(@ApiParam(name = \"caseInstanceId\") @PathVariable String caseInstanceId) {\n        CaseInstance caseInstance = getCaseInstanceFromRequest(caseInstanceId);\n\n        CaseDefinition caseDef = repositoryService.getCaseDefinition(caseInstance.getCaseDefinitionId());\n\n        if (caseDef != null && caseDef.hasGraphicalNotation()) {\n            CmmnModel cmmnModel = repositoryService.getCmmnModel(caseDef.getId());\n            CaseDiagramGenerator diagramGenerator = cmmnEngineConfiguration.getCaseDiagramGenerator();\n            InputStream resource = diagramGenerator.generateDiagram(cmmnModel, \"png\", cmmnEngineConfiguration.getActivityFontName(), cmmnEngineConfiguration.getLabelFontName(),\n                            cmmnEngineConfiguration.getAnnotationFontName(), cmmnEngineConfiguration.getClassLoader(), 1.0);\n\n            HttpHeaders responseHeaders = new HttpHeaders();\n            responseHeaders.set(\"Content-Type\", \"image/png\");\n            try {\n                return new ResponseEntity<>(IOUtils.toByteArray(resource), responseHeaders, HttpStatus.OK);\n            } catch (Exception e) {\n                throw new FlowableIllegalArgumentException(\"Error exporting diagram\", e);\n            }\n\n        } else {\n            throw new FlowableIllegalArgumentException(\"Case instance with id '\" + caseInstance.getId() + \"' has no graphical notation defined.\");\n        }\n    }\n}\n","sourceCodeStart":59,"sourceCodeEnd":85,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-rest/src/main/java/org/flowable/cmmn/rest/service/api/runtime/caze/CaseInstanceDiagramResource.java#L59-L85","documentation":"getCaseInstanceDiagram reads the diagram resource for the case definition and converts it to PNG bytes. If reading the resource stream or the IOUtils.toByteArray conversion fails, the exception is wrapped in FlowableIllegalArgumentException(\"Error exporting diagram\", e) — the underlying cause is attached, so inspect it.","triggerScenarios":"GET the case instance diagram endpoint where the diagram resource exists (graphical notation is defined) but its stream cannot be read — e.g. resource missing from the deployment store, corrupt/empty PNG in the deployment, or an I/O error while reading the repository resource.","commonSituations":"Deployments generated without diagram data; database resource blob truncated; repository entries removed externally; issues after migrating deployments between environments.","solutions":["Inspect the cause (e.getCause()) of the FlowableIllegalArgumentException to find the real I/O or resource error.","Redeploy the CMMN model ensuring the diagram/diagram resource name is generated and included.","Verify the deployment resource exists via /cmmn-repository/case-definitions/{id}/resourcename.","Check repository blob storage integrity in the database (ACT_GE_BYTEARRAY)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Check the definition has a diagram before requesting it\nif (!caseDefinition.hasGraphicalNotation()) { /* skip diagram fetch */ }","typeGuard":null,"tryCatchPattern":"try { byte[] png = getDiagram(caseInstanceId); }\ncatch (FlowableIllegalArgumentException e) { log.error(\"Diagram export failed\", e.getCause()); /* fallback: serve model XML */ }","preventionTips":["Always inspect the cause chain of the wrapped exception","Redeploy models with diagram data intact","Monitor deployment resource integrity after migrations"],"tags":["rest-api","diagram","io","flowable-cmmn"],"backgroundTag":"file-read-failed","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}