Skip to content

Error when opening a swift package in VSCode: "Failed to load $PACKAGE/Package.swift: stdout maxBuffer length exceeded" #1603

Closed
@semicoleon

Description

@semicoleon

Opening this Swift package in VSCode causes an error to occur almost immediately. The error prevents most of the editor features of this extension from functioning.

To Reproduce
This occurs every time I open this package. Unfortunately this code isn't public and I haven't yet been able to create a minimal reproduction.

I looked at the code a bit and assuming I'm reading it correctly, I think the error is occurring when running swift package show-dependencies --format json. I ran swift package show-dependencies --format json | wc -c which produced 2864113 or a little under 2.9 MB. Based on my reading of the code, that's less than the limit being set for maxBuffer, which is a bit confusing. The JSON doesn't appear to be incorrectly formatted or anything either.

I'll keep trying to get a minimal reproduction of the issue and reply with it if I do.

Expected behavior
The dependency JSON should be able to be loaded successfully.

Environment

  • OS: macOS 15.5
  • Swift version:
Apple Swift version 6.1.1 (swift-6.1.1-RELEASE)
Target: arm64-apple-macosx15.0
  • Visual Studio Code version: 1.100.2 (Universal)
  • vscode-swift version: 2.2.0

Additional context
VSCode Output Panel for "Swift" extension (lightly redacted):

14:11:49: Activating Swift for Visual Studio Code...
14:11:50: SourceKit-LSP setup
14:12:13: $PACKAGE: Failed to load Package.swift: stdout maxBuffer length exceeded
14:12:13: $PACKAGE: add: /path/to/$PACKAGE
14:12:13: $PACKAGE: Resolving Dependencies: starting ... 
14:12:13: Exec Task: ($PACKAGE) swift package resolve
14:12:13: $PACKAGE: focus: /path/to/$PACKAGE
14:12:13: $PACKAGE: Resolving Dependencies: ... done.
14:12:14: $PACKAGE: pluginsUpdated: /path/to/$PACKAGE

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions