# Is VS Code integration broken on Mac now? How to debug? Wrong 'No such module' errors

**URL:** <https://forums.swift.org/t/is-vs-code-integration-broken-on-mac-now-how-to-debug-wrong-no-such-module-errors/76072>\
**Category:** VSCode Swift extension\
**Created:** [November 17, 2024, 6:47pm UTC](https://forums.swift.org/t/is-vs-code-integration-broken-on-mac-now-how-to-debug-wrong-no-such-module-errors/76072 "2024-11-17T18:47:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![RussBaz](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/russbaz/32/30841_2.png) [@RussBaz](https://forums.swift.org/u/RussBaz)\
**Post date:** [November 17, 2024, 6:47pm UTC](https://forums.swift.org/t/is-vs-code-integration-broken-on-mac-now-how-to-debug-wrong-no-such-module-errors/76072/1 "2024-11-17T18:47:24Z")

</div>

Hi. Something has happened to my VS Code and I do not remember which update made it break.

```swift
VS Code: 1.95.3
Swift Extension: 1.11.3
macOS: 15.1 (M1)

swift --version

swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
Target: arm64-apple-macosx15.0

```

It now struggles to find anything imported. For example, in `Package.swift` on the very first two lines:

```swift
// swift-tools-version:5.10
import PackageDescription

```

I get the following error displayed:

```swift
No such module 'PackageDescription'

```

This and many other errors prevent me from doing basic stuff such as viewing the variable types or jumping to definitions.

And yet it compiles and the debugger runs fine! In addition, many import statements are failing in random parts. Such as `No such module 'Vapor'` and so on.

Am I the only one this unlucky? Can anyone suggest how to debug this problem? Restarting the editor did not help so far.

Thank you!

---

<div class="post-metadata">

**Author:** ![plemarquand](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/plemarquand/32/32097_2.png) [@plemarquand](https://forums.swift.org/u/plemarquand)\
**Post date:** [November 18, 2024, 12:26am UTC](https://forums.swift.org/t/is-vs-code-integration-broken-on-mac-now-how-to-debug-wrong-no-such-module-errors/76072/2 "2024-11-18T00:26:19Z")

</div>

Sounds like it could be an issue with how sourcekit-lsp is set up.

Could you run the ` > Swift Capture VS Code Diagnostic Bundle` command and attach the output in a .zip? Capturing minimal diagnostics should be OK.

---

<div class="post-metadata">

**Author:** ![RussBaz](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/russbaz/32/30841_2.png) [@RussBaz](https://forums.swift.org/u/RussBaz)\
**Post date:** [November 18, 2024, 10:59am UTC](https://forums.swift.org/t/is-vs-code-integration-broken-on-mac-now-how-to-debug-wrong-no-such-module-errors/76072/3 "2024-11-18T10:59:45Z")

</div>

Here is the minimal diagnostic (I have only adjusted the project name). It was surprisingly short and only two files.

extension-logs.txt:

```swift
15:49:05: SourceKit-LSP setup
15:49:05: Failed to find /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lldb-vscode
15:49:07: MyServer: add: /Users/ruslan/Projects/MyServer
15:49:07: MyServer: focus: /Users/ruslan/Projects/MyServer

```

settings.txt:

```swift
Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
Swift Path: /usr/bin
Toolchain Path: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr
Runtime Library Path: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx:/usr/lib/swift
Default Target: arm64-apple-macosx15.0
Default SDK: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk
XCTest Path: /Applications/Xcode.app/Contents/Developer/usr/bin
Settings:
{
  "path": "",
  "buildArguments": [],
  "additionalTestArguments": [],
  "testEnvironmentVariables": {},
  "sanitizer": "off",
  "searchSubfoldersForPackages": false,
  "autoGenerateLaunchConfigurations": true,
  "disableAutoResolve": true,
  "diagnosticsCollection": "keepSourceKit",
  "diagnosticsStyle": "llvm",
  "backgroundCompilation": false,
  "actionAfterBuildError": "Focus Terminal",
  "buildPath": "",
  "disableSwiftPackageManagerIntegration": false,
  "warnAboutSymlinkCreation": true,
  "enableTerminalEnvironment": true,
  "excludeFromCodeCoverage": [],
  "excludePathsFromPackageDependencies": [
    ".git",
    ".github"
  ],
  "showBuildStatus": "swiftStatus",
  "showCreateSwiftProjectInWelcomePage": true,
  "openAfterCreateNewProject": "prompt",
  "sourcekit-lsp": {
    "serverPath": "",
    "serverArguments": [],
    "supported-languages": [
      "swift",
      "objective-c",
      "objective-cpp",
      "c",
      "cpp"
    ],
    "backgroundIndexing": true,
    "trace": {
      "server": "off"
    },
    "disable": false
  },
  "debugger": {
    "useDebugAdapterFromToolchain": false,
    "path": ""
  },
  "swiftEnvironmentVariables": {},
  "runtimePath": "",
  "SDK": "",
  "diagnostics": false
}

```

---

<div class="post-metadata">

**Author:** ![Sean.Batson](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/sean.batson/32/40290_2.png) [@Sean.Batson](https://forums.swift.org/u/Sean.Batson)\
**Post date:** [November 18, 2024, 11:44am UTC](https://forums.swift.org/t/is-vs-code-integration-broken-on-mac-now-how-to-debug-wrong-no-such-module-errors/76072/4 "2024-11-18T11:44:14Z")

</div>

Before the update if your swift version was 6.0.1 then the update that moved you to 6.0.2 might have cause the lldb-vs-code to be removed… just my two cents…

---

<div class="post-metadata">

**Author:** ![plemarquand](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/plemarquand/32/32097_2.png) [@plemarquand](https://forums.swift.org/u/plemarquand)\
**Post date:** [November 18, 2024, 4:06pm UTC](https://forums.swift.org/t/is-vs-code-integration-broken-on-mac-now-how-to-debug-wrong-no-such-module-errors/76072/5 "2024-11-18T16:06:51Z")

</div>

Nothing is jumping out at me right away. Is the problem still there if you simply create a new package with `swift package init` and open the Package.swift?

If it is open that generated package in VS Code, try and trigger an auto completion in the Package.swift and then do `> Swift Capture VS Code Diagnostic Bundle` capturing a full diagnostic instead of a minimal bundle.

You can also check the contents of Output \> SourceKit Language Server (from the dropdown in the Output tab) and look for suspicious errors.

---

<div class="post-metadata">

**Author:** ![RussBaz](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/russbaz/32/30841_2.png) [@RussBaz](https://forums.swift.org/u/RussBaz)\
**Post date:** [November 18, 2024, 5:17pm UTC](https://forums.swift.org/t/is-vs-code-integration-broken-on-mac-now-how-to-debug-wrong-no-such-module-errors/76072/6 "2024-11-18T17:17:54Z")

</div>

I have created a new empty project, and it worked perfectly well. All features working well.

Next I decided to try removing `.index-build` folder (it did not help), but then I removed it together with the `.buid` folder before recompiling. This time the LSP worked perfectly fine again.

I have captured the full diagnostics before removing the old `.build` folder. The crashes and logs folders are empty. However, the `log.txt` was not empty.

Does anyone know how I can attach a text file to messages in this forum? The log file does not tell me much, but maybe it will help the extension and LSP developers in the future at some point.

To be honest, I have previously encountered cases where running `swift package update` broke something, preventing the project from compiling at all until I manually removed the `.build` folder. Unfortunately, I never figured out what went wrong nor how to reproduce the issue.
