{"record":{"id":"2672035bdafd06ab","repo":"flowable/flowable-engine","slug":"must-specify-a-process-migration-document-to-migra-267203","errorCode":null,"errorMessage":"Must specify a process migration document to migrate","messagePattern":"Must specify a process migration document to migrate","errorType":"validation","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ProcessInstanceMigrationValidationCmd.java","lineNumber":39,"sourceCode":"import org.flowable.engine.migration.ProcessInstanceMigrationManager;\nimport org.flowable.engine.migration.ProcessInstanceMigrationValidationResult;\n\npublic class ProcessInstanceMigrationValidationCmd implements Command<ProcessInstanceMigrationValidationResult> {\n    \n    protected String processInstanceId;\n    protected String processDefinitionId;\n    protected String processDefinitionKey;\n    protected int processDefinitionVersion;\n    protected String processDefinitionTenantId;\n    protected ProcessInstanceMigrationDocument processInstanceMigrationDocument;\n\n    public ProcessInstanceMigrationValidationCmd(String processInstanceId, ProcessInstanceMigrationDocument processInstanceMigrationDocument) {\n        if (processInstanceId == null) {\n            throw new FlowableException(\"Must specify a process instance id to migrate\");\n        }\n        \n        if (processInstanceMigrationDocument == null) {\n            throw new FlowableException(\"Must specify a process migration document to migrate\");\n        }\n\n        this.processInstanceId = processInstanceId;\n        this.processInstanceMigrationDocument = processInstanceMigrationDocument;\n    }\n\n    public ProcessInstanceMigrationValidationCmd(ProcessInstanceMigrationDocument processInstanceMigrationDocument, String processDefinitionId) {\n        if (processDefinitionId == null) {\n            throw new FlowableException(\"Must specify a process definition id to migrate\");\n        }\n        \n        if (processInstanceMigrationDocument == null) {\n            throw new FlowableException(\"Must specify a process migration document to migrate\");\n        }\n\n        this.processDefinitionId = processDefinitionId;\n        this.processInstanceMigrationDocument = processInstanceMigrationDocument;\n    }","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/ProcessInstanceMigrationValidationCmd.java#L21-L57","documentation":"ProcessInstanceMigrationValidationCmd requires a non-null ProcessInstanceMigrationDocument in all of its constructors. When the document argument is null the constructor throws this FlowableException, since there is no migration mapping to validate. It is a fail-fast check identical to the one in the migration command.","triggerScenarios":"Invoking new ProcessInstanceMigrationValidationCmd(processInstanceId, null) or any other validation constructor with a null document — typically because the document build/parse step produced null.","commonSituations":"Deserializing a migration document JSON that failed silently and returned null; a builder chain short-circuited; passing an uninitialized field; calling the internal command classes directly in tests with placeholder nulls.","solutions":["Create the document with the migration builder: managementService.createProcessInstanceMigrationBuilder().migrateToProcessDefinition(...).getProcessInstanceMigrationDocument()","If loading the document from JSON, check the parse/build result for null before validating","Assert the document reference before constructing the validation command"],"exampleFix":"// before\nnew ProcessInstanceMigrationValidationCmd(instId, maybeDoc); // maybeDoc null\n// after\nObjects.requireNonNull(maybeDoc, \"migration document required\");\nnew ProcessInstanceMigrationValidationCmd(instId, maybeDoc);","handlingStrategy":"validation","validationCode":"if (processInstanceMigrationDocument == null) {\n    throw new IllegalArgumentException(\"ProcessInstanceMigrationDocument is required\");\n}","typeGuard":"boolean hasMigrationDoc(ProcessInstanceMigrationDocument d) { return d != null; }","tryCatchPattern":"try {\n    validationCmd.execute(commandContext);\n} catch (FlowableException e) {\n    if (e.getMessage().contains(\"Must specify a process migration document\")) {\n        doc = migrationBuilder.getProcessInstanceMigrationDocument();\n    }\n    throw e;\n}","preventionTips":["Build documents with the official builder API","Check for null right after any JSON deserialization of a document","Keep document construction and validation in the same code path"],"tags":["flowable","process-migration","null-argument","validation"],"backgroundTag":"null-argument","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"}