SourceKit-LSP fails loading the standard library while using Build Server Protocol

I am using sourcekit-bazel-bsp, the Bazel BSP implementation for SourceKit-LSP. The BSP ←→ LSP integration has been working well with Xcode 16.3 however, after upgrading our Xcode version to Xcode 26.0.1, I am seeing the following error on all Swift files in my project:

Internal SourceKit error: error response (Request Failed): Loading the standard library failed

This is my .sourcekit-lsp/config.json

{
  "backgroundIndexing": true,
  "backgroundPreparationMode": "build",
  "defaultWorkspaceType": "buildServer",
}

And the output of the Swift Output path:

10:27:43: Activating Swift for Visual Studio Code...
10:27:43: Apple Swift version 6.2 (swiftlang-6.2.0.19.9 clang-1700.3.19.1)
Platform: darwin
Swift Path: /Applications/Xcode26.0_17A400.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Toolchain Path: /Applications/Xcode26.0_17A400.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr
Runtime Library Path: /Applications/Xcode26.0_17A400.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx:/usr/lib/swift
Default Target: arm64-apple-macosx15.0
Default SDK: /Applications/Xcode26.0_17A400.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.0.sdk
XCTest Path: /Applications/Xcode26.0_17A400.app/Contents/Developer/usr/bin
10:27:43: SourceKit-LSP setup
10:27:43: focus: undefined

For my project, I am specifically building and indexing against the iOS simulator sdk using the -target arm64-apple-ios14.0-simulator -sdk /Applications/Xcode26.0_17A400.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator26.0.sdk flags.

I am having trouble figuring out how to address these problems. I do not see any errors in the BSP and background indexing. At glance, it seems as though the macOS SDK is being set as the default SDK and it may be causing issues? So far I have tried the following but no luck:

  • Deleted all Xcodes + caches
  • Re-installed Xcode 26.0.1
  • Tried setting Swift: SDK workspace setting

I’d appreciate any guidance on how to resolve these Loading the standard library failed errors. Thanks in advance!

Could you file an issue for this in GitHub - swiftlang/sourcekit-lsp: Language Server Protocol implementation for Swift and C-based languages and attach the output of sourcekit-lsp diagnose to it?

If you are willing to enable extended logging, reproduce the issue and only run sourcekit-lsp diagnose afterwards, that would greatly help us figure out what’s going on here. Note that this will include potentially sensitive information like file contents and file paths in the diagnostic bundle.

Also as an aside: "backgroundPreparationMode": "build" only has an affect for SwiftPM projects and won’t affect you if you’re using a BSP server.