{"record":{"id":"6cb7b1b624672f55","repo":"flowable/flowable-engine","slug":"could-not-find-a-model-with-id-modelid","errorCode":null,"errorMessage":"Could not find a model with id '${modelId}'.","messagePattern":"Could not find a model with id '(.+?)'\\.","errorType":"http","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/BaseModelResource.java","lineNumber":45,"sourceCode":"public class BaseModelResource {\n\n    @Autowired\n    protected RestResponseFactory restResponseFactory;\n\n    @Autowired\n    protected RepositoryService repositoryService;\n    \n    @Autowired(required=false)\n    protected BpmnRestApiInterceptor restApiInterceptor;\n\n    /**\n     * Returns the {@link Model} that is requested. Throws the right exceptions when bad request was made or model was not found.\n     */\n    protected Model getModelFromRequest(String modelId) {\n        Model model = repositoryService.createModelQuery().modelId(modelId).singleResult();\n\n        if (model == null) {\n            throw new FlowableObjectNotFoundException(\"Could not find a model with id '\" + modelId + \"'.\", ProcessDefinition.class);\n        }\n        \n        if (restApiInterceptor != null) {\n            restApiInterceptor.accessModelInfoById(model);\n        }\n        \n        return model;\n    }\n}\n","sourceCodeStart":27,"sourceCodeEnd":55,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/BaseModelResource.java#L27-L55","documentation":"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.","triggerScenarios":"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).","commonSituations":"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).","solutions":["List current models via GET /repository/models and use an existing id.","Verify the id is a model id, not a process definition or deployment id.","Check the REST app points at the database where the model exists.","Handle HTTP 404 client-side and re-sync the model list."],"exampleFix":"// before\nGET /repository/models/PROC-DEF-123\n// after\nGET /repository/models/10501 // id from /repository/models","handlingStrategy":"try-catch","validationCode":"const models = (await get('/repository/models')).data;\nif (!models.data.some(m => m.id === modelId)) throw new Error(`Model ${modelId} not found`);","typeGuard":null,"tryCatchPattern":"try { return await getModel(modelId); }\ncatch (e) { if (e instanceof FlowableObjectNotFoundException || e.status === 404) { return syncModelList(); } throw e; }","preventionTips":["Do not confuse model ids with process definition or deployment ids.","Re-fetch model lists after deletions in the Flowable Modeler.","Handle 404 for model endpoints by re-syncing, not retrying."],"tags":["rest-api","not-found","model","repository"],"backgroundTag":"entity-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"}