{"record":{"id":"a1ede23994527c91","repo":"flowable/flowable-engine","slug":"model-with-id-modelid-does-not-have-source-av","errorCode":null,"errorMessage":"Model with id '${modelId}' does not have source available.","messagePattern":"Model with id '(.+?)' does not have source available\\.","errorType":"http","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/ModelSourceResource.java","lineNumber":61,"sourceCode":" * @author Frederik Heremans\n */\n@RestController\n@Api(tags = { \"Models\" }, authorizations = { @Authorization(value = \"basicAuth\") })\npublic class ModelSourceResource extends BaseModelSourceResource {\n\n    @ApiOperation(value = \"Get the editor source for a model\", tags = { \"Models\" },\n            notes = \"Response body contains the model’s raw editor source. The response’s content-type is set to application/octet-stream, regardless of the content of the source.\")\n    @ApiResponses(value = {\n            @ApiResponse(code = 200, message = \"Indicates the model was found and source is returned.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested model was not found.\")\n    })\n    @GetMapping(\"/repository/models/{modelId}/source\")\n    @ResponseBody\n    public byte[] getModelBytes(@ApiParam(name = \"modelId\") @PathVariable String modelId, HttpServletResponse response) {\n        Model model = getModelFromRequest(modelId);\n        byte[] editorSource = repositoryService.getModelEditorSource(model.getId());\n        if (editorSource == null) {\n            throw new FlowableObjectNotFoundException(\"Model with id '\" + modelId + \"' does not have source available.\", String.class);\n        }\n        response.setContentType(\"application/octet-stream\");\n        return editorSource;\n    }\n\n    @ApiOperation(value = \"Set the editor source for a model\", tags = { \"Models\" }, consumes = \"multipart/form-data\",\n            notes = \"Response body contains the model’s raw editor source. The response’s content-type is set to application/octet-stream, regardless of the content of the source.\",\n            code = 204)\n    @ApiImplicitParams({\n            @ApiImplicitParam(name = \"file\", dataType = \"file\", paramType = \"form\", required = true)\n    })\n    @ApiResponses(value = {\n            @ApiResponse(code = 204, message = \"Indicates the model was found and the source has been updated.\"),\n            @ApiResponse(code = 404, message = \"Indicates the requested model was not found.\")\n    })\n    @PutMapping(value = \"/repository/models/{modelId}/source\", consumes = \"multipart/form-data\")\n    @ResponseStatus(HttpStatus.NO_CONTENT)\n    public void setModelSource(@ApiParam(name = \"modelId\") @PathVariable String modelId, HttpServletRequest request) {","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/ModelSourceResource.java#L43-L79","documentation":"Thrown by GET /repository/models/{modelId}/source when the model exists but its editor source bytes are null. repositoryService.getModelEditorSource returns null and the resource raises FlowableObjectNotFoundException.","triggerScenarios":"GET /repository/models/{modelId}/source for a model never given an editor source — e.g. created via POST /repository/models with only metadata, or an imported/deployed model lacking stored source.","commonSituations":"Programmatic model creation without addModelEditorSource; models migrated between environments losing ACT_GE_BYTEARRAY references; clients assuming every model has downloadable source.","solutions":["Confirm the model id is correct and the model should have source","Set the source first via PUT /repository/models/{modelId}/source with a multipart file, then re-fetch","Handle the 404 client-side when source is optional","Re-export/re-import the model from the designer if source was lost in migration"],"exampleFix":"// before\ncurl -X GET .../repository/models/myModelId/source   # 404\n// after\ncurl -X PUT -F 'file=@model-source.xml' .../repository/models/myModelId/source\ncurl -X GET .../repository/models/myModelId/source","handlingStrategy":"try-catch","validationCode":"boolean hasSource = model != null && repositoryService.getModelEditorSource(model.getId()) != null;\nif (!hasSource) { /* set source first or skip */ }","typeGuard":null,"tryCatchPattern":"try { byte[] src = getModelBytes(modelId); } catch (FlowableObjectNotFoundException e) { /* fall back to bundled default source */ }","preventionTips":["Call addModelEditorSource whenever creating models via the API","Handle 404 as 'source not set' rather than 'model missing'","Keep a fallback default source in client code"],"tags":["flowable","rest","resource-not-found","model"],"backgroundTag":"resource-not-found","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"}