flowable/flowable-engine · error · FlowableObjectNotFoundException

Model with id ' ' does not have source available.

Error message

Model with id '${modelId}' does not have source available.

What it means

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.

Solutions

  1. Confirm the model id is correct and the model should have source
  2. Set the source first via PUT /repository/models/{modelId}/source with a multipart file, then re-fetch
  3. Handle the 404 client-side when source is optional
  4. Re-export/re-import the model from the designer if source was lost in migration

Example fix

// before
curl -X GET .../repository/models/myModelId/source   # 404
// after
curl -X PUT -F 'file=@model-source.xml' .../repository/models/myModelId/source
curl -X GET .../repository/models/myModelId/source
Defensive patterns

Strategy: try-catch

Validate before calling

boolean hasSource = model != null && repositoryService.getModelEditorSource(model.getId()) != null;
if (!hasSource) { /* set source first or skip */ }

Try / catch

try { byte[] src = getModelBytes(modelId); } catch (FlowableObjectNotFoundException e) { /* fall back to bundled default source */ }

Prevention

When it happens

Trigger: 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.

Common situations: Programmatic model creation without addModelEditorSource; models migrated between environments losing ACT_GE_BYTEARRAY references; clients assuming every model has downloadable source.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/a1ede23994527c91. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/ModelSourceResource.java:61

 * @author Frederik Heremans
 */
@RestController
@Api(tags = { "Models" }, authorizations = { @Authorization(value = "basicAuth") })
public class ModelSourceResource extends BaseModelSourceResource {

    @ApiOperation(value = "Get the editor source for a model", tags = { "Models" },
            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.")
    @ApiResponses(value = {
            @ApiResponse(code = 200, message = "Indicates the model was found and source is returned."),
            @ApiResponse(code = 404, message = "Indicates the requested model was not found.")
    })
    @GetMapping("/repository/models/{modelId}/source")
    @ResponseBody
    public byte[] getModelBytes(@ApiParam(name = "modelId") @PathVariable String modelId, HttpServletResponse response) {
        Model model = getModelFromRequest(modelId);
        byte[] editorSource = repositoryService.getModelEditorSource(model.getId());
        if (editorSource == null) {
            throw new FlowableObjectNotFoundException("Model with id '" + modelId + "' does not have source available.", String.class);
        }
        response.setContentType("application/octet-stream");
        return editorSource;
    }

    @ApiOperation(value = "Set the editor source for a model", tags = { "Models" }, consumes = "multipart/form-data",
            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.",
            code = 204)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "file", dataType = "file", paramType = "form", required = true)
    })
    @ApiResponses(value = {
            @ApiResponse(code = 204, message = "Indicates the model was found and the source has been updated."),
            @ApiResponse(code = 404, message = "Indicates the requested model was not found.")
    })
    @PutMapping(value = "/repository/models/{modelId}/source", consumes = "multipart/form-data")
    @ResponseStatus(HttpStatus.NO_CONTENT)
    public void setModelSource(@ApiParam(name = "modelId") @PathVariable String modelId, HttpServletRequest request) {

View on GitHub (pinned to d6d39ce1c6)