{"record":{"id":"a1aa6f7bd73bd5bc","repo":"flowable/flowable-engine","slug":"no-process-definition-found-for-id","errorCode":null,"errorMessage":"No process definition found for id '","messagePattern":"No process definition found for id '","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetStartFormCmd.java","lineNumber":45,"sourceCode":"import org.flowable.engine.repository.ProcessDefinition;\n\n/**\n * @author Tom Baeyens\n */\npublic class GetStartFormCmd implements Command<StartFormData>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    protected String processDefinitionId;\n\n    public GetStartFormCmd(String processDefinitionId) {\n        this.processDefinitionId = processDefinitionId;\n    }\n\n    @Override\n    public StartFormData execute(CommandContext commandContext) {\n        ProcessDefinition processDefinition = CommandContextUtil.getProcessEngineConfiguration(commandContext).getDeploymentManager().findDeployedProcessDefinitionById(processDefinitionId);\n        if (processDefinition == null) {\n            throw new FlowableObjectNotFoundException(\"No process definition found for id '\" + processDefinitionId + \"'\", ProcessDefinition.class);\n        }\n\n        if (Flowable5Util.isFlowable5ProcessDefinition(processDefinition, commandContext)) {\n            return Flowable5Util.getFlowable5CompatibilityHandler().getStartFormData(processDefinitionId);\n        }\n\n        FormHandlerHelper formHandlerHelper = CommandContextUtil.getProcessEngineConfiguration(commandContext).getFormHandlerHelper();\n        StartFormHandler startFormHandler = formHandlerHelper.getStartFormHandler(commandContext, processDefinition);\n        if (startFormHandler == null) {\n            throw new FlowableException(\"No startFormHandler defined in process definition '\" + processDefinitionId + \"'\");\n        }\n\n        return startFormHandler.createStartFormData(processDefinition);\n    }\n\n}\n","sourceCodeStart":27,"sourceCodeEnd":62,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetStartFormCmd.java#L27-L62","documentation":"GetStartFormCmd.execute resolves the deployed process definition by id via DeploymentManager.findDeployedProcessDefinitionById and throws FlowableObjectNotFoundException carrying ProcessDefinition.class when nothing is deployed under that id. It is a lookup failure on the ACT_RE_PROCDEF table, not a form problem.","triggerScenarios":"FormService.getStartFormMetadata / getStartFormData or TaskService equivalents invoked with a processDefinitionId that does not exist in the repository (wrong id, deleted deployment, other database/tenant).","commonSituations":"Hard-coded process definition ids that change between deployments; running against a test/h2 database while the definition was deployed to another DB; cluster nodes pointing at different datasources; stale cached ids after redeployment deleted the old definition; tenant confusion where the definition exists but under a different tenant.","solutions":["Fetch a fresh id at runtime via RepositoryService.createProcessDefinitionQuery().processDefinitionKey(key).latestVersion().singleResult() instead of hard-coding the id","Verify the id exists with repositoryService.getProcessDefinition(id) before calling the form API","Check you are connected to the same database the definition was deployed to (inspect ACT_RE_PROCDEF)","Redeploy the process definition if the deployment was removed"],"exampleFix":"// before\nProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(\"myProc:1:123\").singleResult();\nformService.getStartFormMetadata(\"myProc:1:123\");\n// after\nProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionKey(\"myProc\").latestVersion().singleResult();\nformService.getStartFormMetadata(pd.getId());","handlingStrategy":"validation","validationCode":"ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()\n        .processDefinitionId(processDefinitionId).singleResult();\nif (pd == null) throw new IllegalStateException(\"Process definition not deployed: \" + processDefinitionId);","typeGuard":"boolean processDefinitionExists(RepositoryService rs, String id) {\n    return id != null && rs.createProcessDefinitionQuery().processDefinitionId(id).count() > 0;\n}","tryCatchPattern":"try {\n    return formService.getStartFormData(processDefinitionId);\n} catch (FlowableObjectNotFoundException e) {\n    if (e.getObjectClass() == ProcessDefinition.class) {\n        log.warn(\"Process definition {} not found; refreshing id\", processDefinitionId);\n        return null;\n    }\n    throw e;\n}","preventionTips":["Never hard-code process definition ids; resolve latest version by key at runtime","Ensure all engine instances in the cluster share the same database","Re-resolve ids after redeployments, since deletes/updates invalidate old ids"],"tags":["flowable","process-definition","not-found"],"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"}