Symptom: ERROR log shows: Cannot update batch instance with identifier BIxxx as batch status is DELETED
If this is a reoccurring occurrence with new batch instances, you will first want to troubleshoot what caused the error before resolving these orphaned batch instances errors. One area that you will want to investigate to prevent these types of errors in the future, if not done so already is the solution for database deadlock errors (that applies to databases created before 18.104.22.168 SP2). Once this is done, you can perform the following.
To remove this error you can do the following:
1. Execute the following query on the database:
update batch_instance set batch_status = ‘ERROR’ where identifier = ‘ BIxxx’;
2. Go to the JBPM4_JOB delete all records in this table.
3. Go to the WebUI and try to delete the batch.
4. Restart all batches in the running state
Note*: It is never recommended to play with database manually without discussion as it may lead to inconsistent state of database.
This solution will stop the background running JBPM processes from running the workflow for that batch. After it will allow you delete the batch and leave no trace in the logs.