{"record":{"id":"b79e3ea183a3682b","repo":"flowable/flowable-engine","slug":"this-form-type-only-support-process-definitions-b","errorCode":null,"errorMessage":"This form type only support process definitions, but is \" + modelValue.getClass()","messagePattern":"This form type only support process definitions, but is \" \\+ modelValue\\.getClass\\(\\)","errorType":"exception","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-rest/src/main/java/org/flowable/rest/form/ProcessDefinitionFormType.java","lineNumber":57,"sourceCode":"        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}\n","sourceCodeStart":39,"sourceCodeEnd":62,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-rest/src/main/java/org/flowable/rest/form/ProcessDefinitionFormType.java#L39-L62","documentation":"ProcessDefinitionFormType converts a form value that must be a Flowable ProcessDefinition entity into its String id. The library throws FlowableIllegalArgumentException when the supplied model value is not null but also not a ProcessDefinition instance, because no meaningful form value can be derived from any other object type.","triggerScenarios":"Calling convertModelValueToFormValue(Object) with a non-null object that is not a ProcessDefinition — e.g. passing a String id, a Deployment, a ProcessDefinitionEntity from a different engine, or any arbitrary POJO as the form variable value.","commonSituations":"Developers set a form variable expecting the form type to accept the process definition id string, or accidentally pass the wrong variable (a deployment or model object) into a form property typed as process definition; also happens after refactoring when the variable type changed.","solutions":["Pass an actual org.flowable.engine.repository.ProcessDefinition object, e.g. repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult().","If you only have the id string, return the id directly instead of routing it through this form type.","Null-check and type-check the value (instanceof ProcessDefinition) before calling convertModelValueToFormValue.","Verify the form type registered for the variable is the intended one; use a String form type if the value is just an id."],"exampleFix":"// before\nString formValue = formType.convertModelValueToFormValue(processDefinitionId);\n// after\nProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();\nString formValue = formType.convertModelValueToFormValue(pd);","handlingStrategy":"validation","validationCode":"if (value == null || value instanceof ProcessDefinition) {\n    formValue = formType.convertModelValueToFormValue(value);\n}","typeGuard":"boolean isProcessDefinition(Object v) { return v instanceof org.flowable.engine.repository.ProcessDefinition; }","tryCatchPattern":"try { formValue = formType.convertModelValueToFormValue(value); } catch (FlowableIllegalArgumentException e) { /* wrong type supplied; log value class */ }","preventionTips":["Always fetch the ProcessDefinition via repositoryService before converting","Never pass raw id strings to entity-typed form types","Unit-test form type conversions with real engine entities"],"tags":["flowable","forms","illegal-argument","type-mismatch"],"backgroundTag":"incompatible-source-type","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"}