'Xcode Swift Package Manager error - The repository could not be found

I can't find any SO questions regarding this, but I've run into this problem twice. Basically when I'm trying to add a new package via SPM, I sometimes get the following error:

The repository could not be found. Make sure a valid repository exists at the specified location and try again.

For example, I'm trying to get PanModal (https://github.com/slackhq/PanModal) and I get the following:

enter image description here

What's especially interesting is that while Xcode claims that the repo is not found, it can discover its version on the previous screen:

enter image description here

What can be wrong here? Arguably PanModal just got SPM support, but that's 15 hours ago and I think that should be enough. Also iiuc SPM is decentralized so there shouldn't be cache or registry stuff that's in the way?

Thank you!



Solution 1:[1]

clean DerivedData and add Package again

rm -rf ~/Library/Developer/Xcode/DerivedData/

Solution 2:[2]

When this happened in Xcode 13.3, I just had to trigger the Reset Package Caches action in the Packages menu.

Xcode Reset Package Caches

Solution 3:[3]

I had to disable HTTPS to SSH rewriting for Git.

Check inside your ~/.gitconfig file if you have some line such as:

[url "[email protected]:"]
    insteadOf = https://github.com/

If so comment it or remove when adding Swift Package Manager dependencies.

Solution 4:[4]

For me, I just had to relaunch Xcode ¯\(?)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 izayl
Solution 2 Daniel Saidi
Solution 3 Alqueraf
Solution 4 EBDOKUM