-
Bug
-
Resolution: Fixed
-
High
-
9.2.1, 9.2.3
-
None
-
2
-
Severity 2 - Major
-
2
-
Target repository is not supported for pull requests with error message "ERROR: duplicate key value violates unique constraint"
Excepts from Logs are shared below
023-07-18 15:18:01,524 INFO [12-PullRequestDetectionBackgroundThread:pool-16-thread-2] [BitbucketServerPullRequestDetector] Fetch list of Bitbucket Stash PRs [repositoryId: 315035426] 2023-07-18 15:18:01,523 WARN [12-PullRequestDetectionBackgroundThread:pool-16-thread-1] [PullRequestDetector$1] could not execute batch; SQL [insert into VCS_PULL_REQUEST (VCS_PULL_REQUEST_KEY, TARGET_REPOSITORY_ID, TARGET, SOURCE_REPOSITORY_ID, SOURCE, OPEN_STATUS, SOURCE_PARENT_IDENTIFIER, SOURCE_REPOSITORY_IDENTIFIER, CREATED_DATE, UPDATED_DATE, VCS_PULL_REQUEST_ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; constraint [vcspullreq_keytargetrepo_idx]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute batch org.springframework.dao.DataIntegrityViolationException: could not execute batch; SQL [insert into VCS_PULL_REQUEST (VCS_PULL_REQUEST_KEY, TARGET_REPOSITORY_ID, TARGET, SOURCE_REPOSITORY_ID, SOURCE, OPEN_STATUS, SOURCE_PARENT_IDENTIFIER, SOURCE_REPOSITORY_IDENTIFIER, CREATED_DATE, UPDATED_DATE, VCS_PULL_REQUEST_ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; constraint [vcspullreq_keytargetrepo_idx]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute batch Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into VCS_PULL_REQUEST (VCS_PULL_REQUEST_KEY, TARGET_REPOSITORY_ID, TARGET, SOURCE_REPOSITORY_ID, SOURCE, OPEN_STATUS, SOURCE_PARENT_IDENTIFIER, SOURCE_REPOSITORY_IDENTIFIER, CREATED_DATE, UPDATED_DATE, VCS_PULL_REQUEST_ID) values ('1638', 394450987, 'master', 394450987, 'fix-shooting-off-weight-zero-price-legs', 'TRUE', NULL, NULL, '2023-07-18 15:18:01.521+02', '2023-07-18 15:18:01.521+02', 626721856) was aborted: ERROR: duplicate key value violates unique constraint "vcspullreq_keytargetrepo_idx" Detail: Key (vcs_pull_request_key, target_repository_id)=(1638, 394450987) already exists. Call getNextException to see other errors in the batch.
This was first seen on an instance that was upgraded from Bamboo 7.2.11 to 8.0.13 , then finally to 9.2.3. These errors in the logs coincided with PRs not being picked up automatically.