Install Code Signing Credentials: The specified item already exists in the keychain

ios
code-signing

#1

For the last day we’ve been observing strange behavior from our iOS builds on the Circle CI macOS containers.

Virtually every build has ended on its Install Code Signing Credentials phase with the following output

Dumped code signing settings from the current project to the build artifacts.
Created and unlocked circle.keychain (the password is 'circle').
1 key imported.
security: SecKeychainItemImport: The specified item already exists in the keychain.
security: SecKeychainItemImport: The specified item already exists in the keychain.
security: SecKeychainItemImport: The specified item already exists in the keychain.

CERT_FILE=`mktemp -t cert` && cat > $CERT_FILE && security unlock-keychain -p circle circle.keychain && security import $CERT_FILE -k circle.keychain -T /usr/bin/pkgbuild -T /usr/bin/productbuild -T /usr/bin/codesign returned exit code 1

Action failed: Install Code Signing Credentials

We had changed some of the code signing settings in our project, but starting from some time, even the branches that hadn’t received the changes will result with the same error. I even retried one of the super-old builds and it failed the same way.

I know that we have had Automatic code signing enabled at some point (not anymore), maybe the Xcode’s automatic code signature messed up the container somehow (like installed the cert we’re attempting to import somewhere outside of the circle.keychain, idk).

Not sure what happens here and would really appreciate any assistance with it.


#2