Swift/RangeReplaceableCollection.swift error

I posted an earlier reference but I think this one is more accurate and reflective. So I am making a call to the USGS api to pull some water gauge information. My calls worked perfectly until built with Swift 5.3 (Xcode 12). I am able to get a 200 status code but then after multiple seconds of text appearing and disappearing in the debug console, I get this error:

Fatal error: Can't remove first element from an empty collection: file Swift/RangeReplaceableCollection.swift, line 624

This occurs during the response generation and not in parsing the JSON (never makes it to that point). The app crashes with an unexpectedly unwrapped nil error. I have seen others have a similar issues with certain API calls, and some are even having the issue when querying HealthKit! This seems to be an error in the Swift codebase so not sure what can be done, but any help or suggestions would be welcome.

Thanks!

Mark


So I am not the only one getting this really peculiar error. I can't for the life of me figure out why and given that the code has worked perfectly before I updated to Xcode 12 I am at a loss as to where the issue is or if in fact it has anything to do with my code at all.
.
I was getting the same error while running the app on iOS 14.1 (xCode 12).

Error:
Fatal error: Can't remove first element from an empty collection: file Swift/RangeReplaceableCollection.swift, line 624

Possible cause:
Apple might have changed how the app behaved in multithreaded environment.

What I had done:
I was making array of some model classes in synchronous main queue. But using that array in a different thread.

What I changed to make it work:
Now, I am using that array in the same thread it was being appended in.

Hope this helps. 
Swift/RangeReplaceableCollection.swift error
 
 
Q