Unhelpful error: Could not build Objective-C module 'ModuleName'

Sometimes when loading a package into the VSCode extension the SourceKit-LSP server will return the error

Could not build Objective-C module 'ModuleName'

where ModuleName is the name of some module being imported. This error appears on modules regardless of whether they include any Objective-C or not. Unfortunately I haven't found a consistent way to replicate this error. It appears to disappear if you build the project and restart VSCode. If it is related to the relevant module not being built it is not a very helpful message.

In what situations is this error message meant to appear.

I just filed [SR-15876] Unhelpful error: Could not build Objective-C module ‘ModuleName’ - Swift for the issue. Let’ keep track of the discussion there.

2 Likes