ContentionNotFound - department-of-veterans-affairs/caseflow GitHub Wiki

ContentionNotFound Error

What is it?

The ContentionNotFound error is thrown within the Request Issue Contention class. This error gets thrown if an edited request issue does not have a contention_reference_id OR the contention cannot be retrieved from VBMS, which indicates that the contention correlated to the request issue no longer exists within VBMS. This most commonly occurs for withdrawn issues, since the user is able to see and edit those on the frontend. However, withdrawn issues are deleted from VBMS, which guarantees that this error will be thrown in such scenarios since the description text is unable to be updated on VBMS side. It is important to note that a few of these errors have also been seen to occur on removed request issues as well. It is not entirely clear how this occurs, since removed request issues do not populate within the UI, they are only ‘soft deleted’ by having a closed_status of ‘removed’. Regardless, contentions tied to both removed and withdrawn issues are permanently deleted from VBMS.

How does Caseflow handle this error?

This error is handled in the same way as CannotDeleteContention. Meaning that there is a rescue block within DecisionReviewProcessJob that will stop the job from finishing where the error occurred and write ‘ContentionNotFound’ with the contention id to the error column within the RequestIssuesUpdate table. The biggest difference between ContentionNotFound and CannotDeleteContention is where it occurs. ContentionNotFound stuck jobs are at risk of stopping other edited, removed, or withdrawn issues from being updated within VBMS. CannotDeleteContention errors are only at risk of stopping other removed and withdrawn issues from being updated within VBMS.

How do we ‘un-stick’ Jobs that result in the CannotDeleteContention error?

There is a remediation job that runs nightly called ContentionNotFoundRemediationJob that will allow the job to continue by removing the id of the affected request issue from the edited_request_issue_ids attribute from the request issues update and re-running the job. This job can also safely be run from the rails console by entering ContentionNotFoundRemediationJob.perform_now. It is important to note that occasionally there will be request issues updates that involve more than one update to request issue descriptions. In scenarios such as these, the remediation job may need to be run multiple times.