Hi @Arne_Zelasko
When you migrate a process instance in Camunda using the REST API, the migration must also handle any active incidents and jobs (like timers or async continuations) that are tied to the instance. If they’re not properly mapped or migrated, you’ll get errors like:
- “Process instance contains not migrated incidents”
- “Process instance contains not migrated jobs”
Here’s how to deal with these issues and migrate them properly:
1. Understand Why This Happens
• Jobs (like timers, async tasks) are tied to specific activity IDs in the process definition.
• Incidents are typically linked to jobs or executions that failed.
• When migrating, if your migration plan does not map all activities, the engine can’t determine where those jobs/incidents should go in the new process definition.
2. Use updateEventTriggers=true in the Migration Plan
Jobs like timers or async continuations often need eventTrigger updates. When you create the migration plan, use:
POST /migration/generate
{
"sourceProcessDefinitionId": "id-of-old-definition",
"targetProcessDefinitionId": "id-of-new-definition",
"updateEventTriggers": true
}
This helps Camunda know it should recreate timers and job definitions in the new model.
3. Explicitly Map All Activities Involved
Use the instructions array if auto-mapping fails or doesn’t catch everything. Example:
POST /migration/execute
{
"migrationPlan": {
"sourceProcessDefinitionId": "source-id",
"targetProcessDefinitionId": "target-id",
"instructions": [
{
"sourceActivityIds": ["userTask1"],
"targetActivityIds": ["userTask1"]
},
{
"sourceActivityIds": ["serviceTaskWithTimer"],
"targetActivityIds": ["serviceTaskWithTimer"]
}
],
"updateEventTriggers": true
},
"processInstanceIds": ["a10a..."]
}
Map all steps with jobs or incidents, even if the ID hasn’t changed.
4. What If Incidents Are Still Not Migrated?
You have two options:
Option A: Fix or Resolve Incidents First
Use:
POST /incident/{id}/resolve
Or resolve the job (e.g., fix the underlying problem and retry it), then migrate.
Option B: Delete Incidents (Last Resort)
This avoids blocking the migration, but you lose error context. Only use if the incident is no longer relevant.
5. Double-Check with /job and /incident APIs
You can inspect jobs and incidents for the failing process instance:
GET /job?processInstanceId=a10a...
GET /incident?processInstanceId=a10a...
Check what activities they’re tied to, then ensure those activities are included in your migration plan.