Workspace Integrity - Couldn't load project - Large JS file

I have a Swift package that i've been working on for a while. I upgraded to Xcode 13 a month or two ago. I have a couple of large JS files in my package (third party NPM libraries that I can't re-write). Randomly, Xcode will throw an error (but not a real error because I can continue as normal) that It can't load the folder containing the JS files

This doesn't prevent me from doing anything, but its irritating to have this error constantly showing up. Is there anything I can do to solve this or is this an Xcode bug?

Post not yet marked as solved Up vote post of simonmcl Down vote post of simonmcl
3.7k views
  • I'm getting this same error after creating a new Swift package (without changing anything). This is on Xcode Version 13.2.1 (13C100).

  • I'm getting the same red warning. One of the Swift Package in the project contains a js script. Since it was added, it shows from time to "Workspace integrity - couldn't load project" and points to a hyperesources file.

Add a Comment

Replies

I had the same issue, and after checking more detailed Xcode logs (here is some info on how to do it: https://stackoverflow.com/questions/27536271/how-to-collect-xcode-log )

I did found out that one of the internal folder of my app had the same name as an integrated folder of one of the SPM Package and for an obscured reason, this triggered the error.

If you either exclude the folder from the package (if not needed and you have control over the SPM package you use) or change the name inside the app (if you can), it makes the error disappear.

  • any guidance on how you found this from the output? Its massive and I don't know where to look. Tried searching for the error message and its not throwing anything up

  • @nicolas_s bump

Add a Comment

Finally found a workaround to this. While the error inside Xcode is incredibly cryptic, I noticed an error (more like a warning though) in my CI logs while looking at another issue. Inside the CI logs I found

can't open *** as a "Swift Package Folder" because it is already open as a "Folder"

Inside my SPM I have 3 .js files. To organise it better I put them in a sub folder, and added that folder as a resource inside the Package.swift. There are multiple reports of cocoapods facing the same error message due to some new change/requirement to have resource folders signed. Couldn't figure out how to sign the folder in SPM, so I took a chance and removed the .js files from the subfolder, and list each one of the directly as resources in the package.swift and it solved this issue

Xcode 14 is SSSSSSOOOOOOO buggy!