{"record":{"id":"5b4c4fd9a35f2e2e","repo":"flowable/flowable-engine","slug":"process-definition-with-id-propertyvalue-d","errorCode":null,"errorMessage":"Process definition with id \" + propertyValue + \" does not exist","messagePattern":"Process definition with id \" \\+ propertyValue \\+ \" does not exist","errorType":"exception","errorClass":"FlowableObjectNotFoundException","httpStatus":404,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/form/ProcessDefinitionFormType.java","lineNumber":43,"sourceCode":" */\npublic class ProcessDefinitionFormType extends AbstractFormType {\n\n    private static final long serialVersionUID = 1L;\n\n    public static final String TYPE_NAME = \"processDefinition\";\n\n    @Override\n    public String getName() {\n        return TYPE_NAME;\n    }\n\n    @Override\n    public Object convertFormValueToModelValue(String propertyValue) {\n        if (propertyValue != null) {\n            ProcessDefinition processDefinition = ProcessEngines.getDefaultProcessEngine().getRepositoryService().createProcessDefinitionQuery().processDefinitionId(propertyValue).singleResult();\n\n            if (processDefinition == null) {\n                throw new FlowableObjectNotFoundException(\"Process definition with id \" + propertyValue + \" does not exist\", ProcessDefinitionEntity.class);\n            }\n\n            return processDefinition;\n        }\n        return null;\n    }\n\n    @Override\n    public String convertModelValueToFormValue(Object modelValue) {\n        if (modelValue == null) {\n            return null;\n        }\n        if (!(modelValue instanceof ProcessDefinition)) {\n            throw new FlowableIllegalArgumentException(\"This form type only support process definitions, but is \" + modelValue.getClass());\n        }\n        return ((ProcessDefinition) modelValue).getId();\n    }\n}","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/form/ProcessDefinitionFormType.java#L25-L61","documentation":"ProcessDefinitionFormType.convertFormValueToModelValue resolves a form property value to a ProcessDefinition using the default engine's repository service. If no process definition exists with the given id, it throws FlowableObjectNotFoundException('Process definition with id <id> does not exist'). This guards form rendering/submission against stale or bogus process definition references.","triggerScenarios":"Calling convertFormValueToModelValue(propertyValue) on a 'process definition' form type with an id that does not match any deployed process definition (query returns singleResult() == null).","commonSituations":"Forms saved against a process definition that was later redeployed (new definition id/version); copying form values between environments with different deployments; typos in process definition ids; querying the wrong engine (getDefaultProcessEngine vs the actual engine name).","solutions":["Verify the process definition id exists via RepositoryService.createProcessDefinitionQuery().list()","If the definition was redeployed, resolve the latest version by key instead of storing the versioned id","Ensure ProcessEngines.getDefaultProcessEngine() points at the engine where the definition is deployed","Correct the stored form value to reference an existing definition id"],"exampleFix":"// before\nString defId = storedFormValue; // stale id from a previous deployment\nObject def = formType.convertFormValueToModelValue(defId);\n// after\nProcessDefinition def = repositoryService.createProcessDefinitionQuery()\n    .processDefinitionKey(defKey).latestVersion().singleResult();\nif (def == null) throw new IllegalArgumentException(\"No deployed definition for key \" + defKey);","handlingStrategy":"validation","validationCode":"ProcessDefinition pd = ProcessEngines.getDefaultProcessEngine()\n    .getRepositoryService().createProcessDefinitionQuery()\n    .processDefinitionId(propertyValue).singleResult();\nif (pd == null) {\n    // resolve by key + latest version, or reject the form value before use\n    pd = ProcessEngines.getDefaultProcessEngine().getRepositoryService()\n        .createProcessDefinitionQuery().latestVersion().singleResult();\n}","typeGuard":null,"tryCatchPattern":"try {\n    Object modelValue = formType.convertFormValueToModelValue(propertyValue);\n} catch (FlowableObjectNotFoundException e) {\n    logger.error(\"Form references unknown process definition '{}'; redeploy or refresh form data\", propertyValue, e);\n    throw e;\n}","preventionTips":["Store process definition keys (plus desired version policy) instead of versioned ids in long-lived forms","Re-validate stored form values after redeployments","Confirm the default engine matches the deployment environment (flowable.default=true or named engines)"],"tags":["rest","forms","process-definition"],"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"}