ARTIFACTORY: Why do I get “Failed to pair warm and cold instances please unpair first” error
Problem Statement:
While configuring the Artifactory Cold instance with Live Artifactory instance, we follow a step called binding which creates a type of token called a binding token, which allows trust to be bi-directional and during this process we face different type of issue and one of the issue is explained below with the solution.
In few scenarios, we might receive the below error when adding bindings between live and cold instance.
Cause:
The above error would occur when the cold instance is configured with the empty base URL and the pairing token added is invalid or corrupted. In few cases, if you tried to add the cold instances multiple times, there are chances that the incorrect pairing token gets cached in the Artifactory config descriptor and again adding the cold instance would throw the above error.
Logs from live instance:
mc-service.log:
2022-12-01T09:40:54.511Z [jfmc ] [INFO ] [54993343e7fe7d70] [erviceTrustRepositoryFacade:42] [ttp-nio-8080-exec-10] - Called with empty base urls. No pairings for the given pairing topology request
2022-12-01T09:41:02.157Z [jfmc ] [INFO ] [799b7529e4a07061] [.v.PairingSummaryController:42] [http-nio-8080-exec-7] - Calculate Pairing topology request for service type ARTIFACTORY usecase artifactory-cold and source jpd ids JPD-14,JPD-1,JPD-2
2022-12-01T09:41:02.175Z [jfmc ] [WARN ] [ ] [v.PairingSummaryController:101] [.commonPool-worker-3] - Failed to get pairing details for JPD JPD-14, serviceType ARTIFACTORY, and usecase artifactory-cold
2022-12-01T09:42:09.997Z [jfmc ] [INFO ] [a279254ddfda841 ] [o.j.m.s.AccessTokenFilter:59 ] [http-nio-8080-exec-8] - Authentication failed: Access Token is not valid
2022-12-01T09:42:32.169Z [jfmc ] [WARN ] [799b7529e4a07061] [v.PairingSummaryController:122] [http-nio-8080-exec-7] - Unexpected error: java.util.concurrent.TimeoutException
artifactory-service.log:
2022-12-01T13:31:34.181Z [jfrt ] [ERROR] [20a796b5ebb1329c] [r.r.s.ServiceTrustResource:247] [http-nio-8081-exec-9] - Error while token pairing. Failed to pair warm and cold instances, please unpair first
org.artifactory.servicetrust.cold.ArtifactRetentionBindException: Failed to pair warm and cold instances, please unpair first
Solution:
1. Remove the below section from the artifactory.config.latest.xml file to make sure no pairing token is cached in the artifactory.config.latest.xml<retentionSettings>
<retentionPolicies/>
</retentionSettings>
<authentication>
<tokens/>
</authentication>
2. Rename the file from artifactory.config.latest.xml to artifactory.config.import.xml
3. Perform a restart to the Artifactory for the changes to take effect.
4. Then, go ahead with adding the cold instance using the Rest API as explained in the following KB article.
Once the above steps are performed, you should be able to see the cold instance added in the deployment bindings section as shown below.