flowable/flowable-engine · error · FlowableObjectNotFoundException

Could not find a model with id

Error message

Could not find a model with id '${modelId}'.

What it means

BaseModelResource.getModelFromRequest queries repositoryService.createModelQuery().modelId(modelId); if no model is found it throws FlowableObjectNotFoundException (notably with ProcessDefinition.class as the referenced type, a small quirk of the source). The id simply does not correspond to any stored model.

Solutions

  1. List current models via GET /repository/models and use an existing id.
  2. Verify the id is a model id, not a process definition or deployment id.
  3. Check the REST app points at the database where the model exists.
  4. Handle HTTP 404 client-side and re-sync the model list.

Example fix

// before
GET /repository/models/PROC-DEF-123
// after
GET /repository/models/10501 // id from /repository/models
Defensive patterns

Strategy: try-catch

Validate before calling

const models = (await get('/repository/models')).data;
if (!models.data.some(m => m.id === modelId)) throw new Error(`Model ${modelId} not found`);

Try / catch

try { return await getModel(modelId); }
catch (e) { if (e instanceof FlowableObjectNotFoundException || e.status === 404) { return syncModelList(); } throw e; }

Prevention

When it happens

Trigger: Any GET/PUT/DELETE on /repository/models/{modelId} where {modelId} is not an existing model id in ACT_RE_MODEL (deleted model, wrong environment, or fabricated id).

Common situations: Model deleted in the Flowable Modeler while an editor still holds the old id; dev/prod environment mismatch; id copied from a process-definition instead of a model (different id spaces).

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

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

public class BaseModelResource {

    @Autowired
    protected RestResponseFactory restResponseFactory;

    @Autowired
    protected RepositoryService repositoryService;
    
    @Autowired(required=false)
    protected BpmnRestApiInterceptor restApiInterceptor;

    /**
     * Returns the {@link Model} that is requested. Throws the right exceptions when bad request was made or model was not found.
     */
    protected Model getModelFromRequest(String modelId) {
        Model model = repositoryService.createModelQuery().modelId(modelId).singleResult();

        if (model == null) {
            throw new FlowableObjectNotFoundException("Could not find a model with id '" + modelId + "'.", ProcessDefinition.class);
        }
        
        if (restApiInterceptor != null) {
            restApiInterceptor.accessModelInfoById(model);
        }
        
        return model;
    }
}

View on GitHub (pinned to d6d39ce1c6)