'CircularBuffer error after upgrading to Xcode 13.3, SwiftNIO, Vapor in the mix

I have a project that will not compile, after upgrading to Xcode 13.3 The error is

Type 'CircularBuffer<Element>' does not conform to protocol 'MutableCollection'

and

Unavailable subscript 'subscript(_:)' was used to satisfy a requirement of protocol 'MutableCollection'

This is in the public struct MarkedCircularBuffer<Element>: CustomStringConvertible that is part of SwiftNIO.

This pops up as soon as I try to build the project, which built and ran fine prior to the upgrade to Xcode 13.3.

I don't have a starting point to figure this out. What should I be looking for? My only intuition is that a number of async queries in my code dump the result into a _ rather than a variable, but that seems reasonable given the compiler suggests it…

EDIT: because there is a reference to protocols, I checked my code, and only one protocol is defined (but never implemented):

protocol storesSockets {
//    var sockets: Dictionary<String, Dictionary<String, WebSocket>>
    func addSocket(ws: WebSocket, pId: String, gameId: String, overwrite: Bool)
}

Commenting this code out does not change anything.

UPDATE: I tried updating the packages in Swift... this caused a crash, which restarting Swift didn't fix, but restarting the machine did. Or seems to have. So my problem has gone away...



Solution 1:[1]

I ran into the same problem and updated swift-nio to 2.40.0 to solve the problem.

EDIT: Updating caused a crash sometimes (this might be related to the Apple Silicon M1 Mac) but after the crash and the finished update the error was gone.

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