Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The LWC Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. #4994

Closed
samwolfe-stripe opened this issue Jul 27, 2023 · 15 comments · Fixed by forcedotcom/lightning-language-server#578

Comments

@samwolfe-stripe
Copy link

samwolfe-stripe commented Jul 27, 2023

Summary

When the LWC Language Server attempts to start, it crashes 5 times immediately and no longer tries to restart

Steps To Reproduce:

  1. Open an LWC test file
  2. After a few moments, VSCode will display the message "The LWC Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted."

Expected result

The LWC Language Server should not crash

Actual result

The LWC Language Server crashes
image

Additional information

Error output

TypeError: Cannot read properties of undefined (reading 'location')
    at mapLwcMetadataToInternal (/Users/user/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.7.1/node_modules/@salesforce/lwc-language-server/lib/javascript/type-mapping.js:428:188)
    at compileSource (/Users/user/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.7.1/node_modules/@salesforce/lwc-language-server/lib/javascript/compiler.js:172:66)
    at compileDocument (/Users/user/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.7.1/node_modules/@salesforce/lwc-language-server/lib/javascript/compiler.js:184:12)
    at Server.onDidChangeContent (/Users/user/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.7.1/node_modules/@salesforce/lwc-language-server/lib/lwc-server.js:195:84)
[Error - 12:12:50 PM] Connection to server got closed. Server will not be restarted.

/Users/user/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.7.1/node_modules/@salesforce/lwc-language-server/lib/javascript/type-mapping.js:428
    const declarationLoc = externalToInternalLoc((_a = defaultExport === null || defaultExport === void 0 ? void 0 : defaultExport.location) !== null && _a !== void 0 ? _a : mainClassObj.location);
                                                                                                                                                                                           ^

Other Steps Tried

  • Restarted VSCode
  • Uninstalled and Reinstalled Extension Pack
  • Restarted machine
  • Uninstalled and Reinstalled SF CLI

Salesforce Extension Version in VS Code:

  • Salesforce Extension Pack (Expanded) v58.7.1
  • Lightning Web Components v58.7.1

SFDX CLI Version:

  • sf --version => @salesforce/cli/2.1.7 darwin-arm64 node-v18.15.0

OS and version:

Mac OS Ventura 13.4.1 (c) (M1)

@samuel-pipelaunch
Copy link

samuel-pipelaunch commented Jul 29, 2023

I also have the same issue that has been driving me crazy.

Other Steps Tried

  • Restarted VSCode
  • Uninstalled and Reinstalled Extension Pack (manually deleted the .vscode/extensions/salesforce* folders)
  • Restarted machine
  • Update CLI

The only differences are:

  • @salesforce/cli/1.86.7-legacy.0 win32-x64 node-v18.15.0
  • Windows 11 (x64)
  • openjdk 17.0.7
openjdk 17.0.7 2023-04-18
OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7)
OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode, sharing)

Full VSCode Output log:

\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\node_modules\@salesforce\lwc-language-server\lib\javascript\type-mapping.js:428
    const declarationLoc = externalToInternalLoc((_a = defaultExport === null || defaultExport === void 0 ? void 0 : defaultExport.location) !== null && _a !== void 0 ? _a : mainClassObj.location);
                                                                                                                                                                                           ^

TypeError: Cannot read properties of undefined (reading 'location')
    at mapLwcMetadataToInternal (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\node_modules\@salesforce\lwc-language-server\lib\javascript\type-mapping.js:428:188)
    at compileSource (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\node_modules\@salesforce\lwc-language-server\lib\javascript\compiler.js:172:66)
    at compileDocument (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\node_modules\@salesforce\lwc-language-server\lib\javascript\compiler.js:184:12)
    at Server.onDidChangeContent (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\node_modules\@salesforce\lwc-language-server\lib\lwc-server.js:195:84)
[Info  - 10:28:40 AM] Connection to server got closed. Server will restart.
[Error - 10:28:40 AM] Request textDocument/hover failed.
Error: Connection got disposed.
    at Object.dispose (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\dist\index.js:48:2606)
    at Object.dispose (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\dist\index.js:53:6147)
    at EN.handleConnectionClosed (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\dist\index.js:55:7504)
    at EN.handleConnectionClosed (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\dist\index.js:55:25176)
    at r (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\dist\index.js:55:7223)
    at KD.invoke (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\dist\index.js:19:33354)
    at id.fire (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\dist\index.js:19:34088)
    at B (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\dist\index.js:22:11880)
    at KD.invoke (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\dist\index.js:19:33354)
    at id.fire (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\dist\index.js:19:34088)
    at YD.fireClose (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\dist\index.js:21:1813)
    at ChildProcess.<anonymous> (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\dist\index.js:21:3796)
    at ChildProcess.emit (node:events:525:35)
    at maybeClose (node:internal/child_process:1121:16)
    at Socket.<anonymous> (node:internal/child_process:479:11)
    at Socket.emit (node:events:513:28)
    at Pipe.<anonymous> (node:net:757:14)
\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\node_modules\@salesforce\lwc-language-server\lib\javascript\type-mapping.js:428
    const declarationLoc = externalToInternalLoc((_a = defaultExport === null || defaultExport === void 0 ? void 0 : defaultExport.location) !== null && _a !== void 0 ? _a : mainClassObj.location);
                                                                                                                                                                                           ^

TypeError: Cannot read properties of undefined (reading 'location')
    at mapLwcMetadataToInternal (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\node_modules\@salesforce\lwc-language-server\lib\javascript\type-mapping.js:428:188)
    at compileSource (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\node_modules\@salesforce\lwc-language-server\lib\javascript\compiler.js:172:66)
    at compileDocument (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\node_modules\@salesforce\lwc-language-server\lib\javascript\compiler.js:184:12)
    at Server.onDidChangeContent (\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\node_modules\@salesforce\lwc-language-server\lib\lwc-server.js:195:84)
[Info  - 10:28:43 AM] Connection to server got closed. Server will restart.
\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.7.1\node_modules\@salesforce\lwc-language-server\lib\javascript\type-mapping.js:428
    const declarationLoc = externalToInternalLoc((_a = defaultExport === null || defaultExport === void 0 ? void 0 : defaultExport.location) !== null && _a !== void 0 ? _a : mainClassObj.location);
                                                                                                                                                                                           
...

[Error - 10:28:49 AM] Connection to server got closed. Server will not be restarted.

@samwolfe-stripe
Copy link
Author

Likely related to forcedotcom/lightning-language-server#570 which is 1: the most recent update to the LWC language server and 2: introduced the function which is failing mapLwcMetadataToInternal

@CristiCanizales
Copy link
Contributor

Hello! Thank you all for bringing this to our attention. We'll be taking a look at it!

@divmain
Copy link

divmain commented Aug 1, 2023

@samuel-pipelaunch @samwolfe-stripe this looks like a relatively easy fix, apologies for letting this skip through. Do you happen to have a minimal repro that causes this issue? Rather than throwing code over the wall, I'd like to confirm that the fix will address what you're experiencing, if possible. If you don't have a minimal repro, it'd be great if you could manually verify after we push out a fix.

@samwolfe-stripe
Copy link
Author

@divmain Thanks for taking a look, I tried to set up a minimal repo but couldn't actually trigger the LWC Language Server to run (not sure what actually causes it to kick off), so unfortunately can only replicate in my local repo.

Happy to verify a fix manually

@codythomaszeitler
Copy link

codythomaszeitler commented Aug 14, 2023

I made a fix within the lightning-language-server repository.
forcedotcom/lightning-language-server#577

To reproduce the problem, just make an LWC, and remove the default export and put something else in.

export class TestClass {
  get a() {
    return "a";
  }

  b = "b";
}

This should cause the server to crash.

@samuel-pipelaunch
Copy link

I tried the @codythomaszeitler on a sample repository, and I couldn't caused the server to crash

@codythomaszeitler
Copy link

codythomaszeitler commented Aug 15, 2023

@samuel-pipelaunch Okay, I got the exact error that you mentioned above (minus the version number).

I reproduced it in the following manner:

Create a brand sfdx project:

  1. sf project generate --projectname crashme
  2. cd crashme
  3. code . (open up vscode in the current directory)
  4. Wait for all of the extensions to start
  5. Run the following command in vscode: SFDX: Create a Lightning Web Component
  6. Call the LWC "crashMe".

import { LightningElement } from 'lwc'; export default class CrashMe extends LightningElement {}

You'll have something like this.

Replace it with this:
export function add(a, b) { return a + b; }

You will start to see the exception in your "LWC Language Server" output in vscode:

`
c:\Users\Cody.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.9.1\node_modules@salesforce\lwc-language-server\lib\javascript\type-mapping.js:429
const declarationLoc = externalToInternalLoc((_a = defaultExport === null || defaultExport === void 0 ? void 0 : defaultExport.location) !== null && _a !== void 0 ? _a : mainClassObj.location);
^

TypeError: Cannot read properties of undefined (reading 'location')
at mapLwcMetadataToInternal (c:\Users\Cody.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.9.1\node_modules@salesforce\lwc-language-server\lib\javascript\type-mapping.js:429:188)
at compileSource (c:\Users\Cody.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.9.1\node_modules@salesforce\lwc-language-server\lib\javascript\compiler.js:172:66)
at compileDocument (c:\Users\Cody.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.9.1\node_modules@salesforce\lwc-language-server\lib\javascript\compiler.js:184:12)
at Server.onDidChangeContent (c:\Users\Cody.vscode\extensions\salesforce.salesforcedx-vscode-lwc-58.9.1\node_modules@salesforce\lwc-language-server\lib\lwc-server.js:195:84)
`

@codythomaszeitler
Copy link

@samuel-pipelaunch The reason that it is failing is since the file cannot find a "default export". In this specific scenario, the file also has no classes, which let's it get to the error that you found. The error from what I posted is when there is at least one class in the file.

@jesusgonzalezclarivate
Copy link

I have the same problem, but the stack trace seems to be different. I tried reinstalling the plugin as well. I have downgraded the plugin to V58 and it still crashes.

SF CLI version: @salesforce/cli/2.20.6 darwin-arm64 node-v20.9.0

SO: macOS Sonoma Version 14.2

VSCode dump:

/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:652
er = new Error(er)
^

Error: Unexpected close tag
Line: 7910
Column: 13
Char: >
at error (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:652:10)
at strictFail (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:678:7)
at closeTag (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:872:9)
at SAXParser.write (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:1437:13)
at exports.Parser.Parser.parseString (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:323:31)
at Parser.parseString (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:5:59)
at /Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:338:24
at new Promise ()
at exports.Parser.Parser.parseStringPromise (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:336:14)
at Parser.parseStringPromise (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:5:59)

Node.js v18.15.0
[Info - 20:24:14] Connection to server got closed. Server will restart.
/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:652
er = new Error(er)
^

Error: Unexpected close tag
Line: 7910
Column: 13
Char: >
at error (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:652:10)
at strictFail (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:678:7)
at closeTag (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:872:9)
at SAXParser.write (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:1437:13)
at exports.Parser.Parser.parseString (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:323:31)
at Parser.parseString (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:5:59)
at /Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:338:24
at new Promise ()
at exports.Parser.Parser.parseStringPromise (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:336:14)
at Parser.parseStringPromise (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:5:59)

Node.js v18.15.0
[Info - 20:24:17] Connection to server got closed. Server will restart.
/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:652
er = new Error(er)
^

Error: Unexpected close tag
Line: 7910
Column: 13
Char: >
at error (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:652:10)
at strictFail (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:678:7)
at closeTag (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:872:9)
at SAXParser.write (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:1437:13)
at exports.Parser.Parser.parseString (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:323:31)
at Parser.parseString (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:5:59)
at /Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:338:24
at new Promise ()
at exports.Parser.Parser.parseStringPromise (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:336:14)
at Parser.parseStringPromise (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:5:59)

Node.js v18.15.0
[Info - 20:24:20] Connection to server got closed. Server will restart.
/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:652
er = new Error(er)
^

Error: Unexpected close tag
Line: 7910
Column: 13
Char: >
at error (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:652:10)
at strictFail (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:678:7)
at closeTag (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:872:9)
at SAXParser.write (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:1437:13)
at exports.Parser.Parser.parseString (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:323:31)
at Parser.parseString (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:5:59)
at /Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:338:24
at new Promise ()
at exports.Parser.Parser.parseStringPromise (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:336:14)
at Parser.parseStringPromise (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:5:59)

Node.js v18.15.0
[Info - 20:24:23] Connection to server got closed. Server will restart.
/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:652
er = new Error(er)
^

Error: Unexpected close tag
Line: 7910
Column: 13
Char: >
at error (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:652:10)
at strictFail (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:678:7)
at closeTag (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:872:9)
at SAXParser.write (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/sax/lib/sax.js:1437:13)
at exports.Parser.Parser.parseString (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:323:31)
at Parser.parseString (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:5:59)
at /Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:338:24
at new Promise ()
at exports.Parser.Parser.parseStringPromise (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:336:14)
at Parser.parseStringPromise (/Users/jesusgonzalez/.vscode/extensions/salesforce.salesforcedx-vscode-lwc-58.16.0/node_modules/@salesforce/lwc-language-server/node_modules/xml2js/lib/parser.js:5:59)

Node.js v18.15.0
[Error - 20:24:25] Connection to server got closed. Server will not be restarted.

@msuchy96
Copy link

msuchy96 commented Apr 4, 2024

I have the same issue with following stacktrace:

c:\Users\msuch\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-60.5.1\node_modules\sax\lib\sax.js:652
    er = new Error(er)
         ^

Error: Invalid character in entity name
Line: 569
Column: 214
Char: =
    at error (c:\Users\msuch\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-60.5.1\node_modules\sax\lib\sax.js:652:10)
    at strictFail (c:\Users\msuch\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-60.5.1\node_modules\sax\lib\sax.js:678:7)
    at SAXParser.write (c:\Users\msuch\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-60.5.1\node_modules\sax\lib\sax.js:1499:13)
    at exports.Parser.Parser.parseString (c:\Users\msuch\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-60.5.1\node_modules\xml2js\lib\parser.js:323:31)
    at Parser.parseString (c:\Users\msuch\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-60.5.1\node_modules\xml2js\lib\parser.js:5:59)
    at c:\Users\msuch\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-60.5.1\node_modules\xml2js\lib\parser.js:338:24
    at new Promise (<anonymous>)
    at exports.Parser.Parser.parseStringPromise (c:\Users\msuch\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-60.5.1\node_modules\xml2js\lib\parser.js:336:14)
    at Parser.parseStringPromise (c:\Users\msuch\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-60.5.1\node_modules\xml2js\lib\parser.js:5:59)
    at Typing.declarationsFromCustomLabels (c:\Users\msuch\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-60.5.1\node_modules\@salesforce\lwc-language-server\lib\typing.js:68:47)

Node.js v18.17.1
[Error - 11:48:39 AM] Connection to server got closed. Server will not be restarted.

@ministe2003
Copy link

ministe2003 commented Aug 22, 2024

I've recently started getting this issue. I've tried completely uninstalling sf, vscode, java, node and npm. When I go through the process of reinstalling it comes back once I install the extended extension pack.
I installed the cli using the windows executable installer, not npm.

Name: Salesforce Extension Pack (Expanded)
Id: salesforce.salesforcedx-vscode-expanded
Description: Extensions for developing on the Salesforce Platform
Version: 61.10.0
Publisher: Salesforce
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=salesforce.salesforcedx-vscode-expanded

Version: 1.92.2 (user setup)
Commit: fee1edb8d6d72a0ddff41e5f71a671c23ed924b9
Date: 2024-08-14T17:29:30.058Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631

Java:
C:\Program Files\Eclipse Adoptium\jdk-21.0.4.7-hotspot\bin\java.exe

sf:
@salesforce/cli: Updating CLI... already on version 2.55.6-648ad30

c:\Users\My User\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.10.0\node_modules\sax\lib\sax.js:658
    er = new Error(er)
         ^

Error: Invalid character in entity name
Line: 18656
Column: 37
Char:  
    at error (c:\Users\My User\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.10.0\node_modules\sax\lib\sax.js:658:10)
    at strictFail (c:\Users\My User\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.10.0\node_modules\sax\lib\sax.js:684:7)
    at SAXParser.write (c:\Users\My User\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.10.0\node_modules\sax\lib\sax.js:1522:13)
    at exports.Parser.Parser.parseString (c:\Users\My User\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.10.0\node_modules\xml2js\lib\parser.js:323:31)
    at Parser.parseString (c:\Users\My User\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.10.0\node_modules\xml2js\lib\parser.js:5:59)
    at c:\Users\My User\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.10.0\node_modules\xml2js\lib\parser.js:338:24
    at new Promise (<anonymous>)
    at exports.Parser.Parser.parseStringPromise (c:\Users\My User\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.10.0\node_modules\xml2js\lib\parser.js:336:14)
    at Parser.parseStringPromise (c:\Users\My User\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.10.0\node_modules\xml2js\lib\parser.js:5:59)
    at Typing.declarationsFromCustomLabels (c:\Users\My User\.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.10.0\node_modules\@salesforce\lwc-language-server\lib\typing.js:68:47)

Node.js v20.14.0
[Error - 11:16:37 AM] Connection to server got closed. Server will not be restarted.

@jean-feng
Copy link

I got a new C driver, installed new Windows:
Edition Windows 10 Enterprise
Version 22H2
Installed on ‎9/‎6/‎2024
OS build 19045.4894
Experience Windows Feature Experience Pack 1000.19060.1000.0

Then I installed sf @salesforce/cli/2.58.7 win32-x64 node-v20.17.0

Visual Studio Code
Version: 1.93.1 (user setup)
Commit: 38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40
Date: 2024-09-11T17:20:05.685Z
Electron: 30.4.0
ElectronBuildId: 10073054
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.19045

Once I installed Salesforce Extension Pack
v61.12.0

I got The LWC Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted.

c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:658
er = new Error(er)
^

Error: Unexpected close tag
Line: 1886
Column: 15
Char: >
at error (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:658:10)
at strictFail (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:684:7)
at closeTag (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:878:9)
at SAXParser.write (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:1460:13)
at exports.Parser.Parser.parseString (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:323:31)
at Parser.parseString (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:5:59)
at c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:338:24
at new Promise ()
at exports.Parser.Parser.parseStringPromise (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:336:14)
at Parser.parseStringPromise (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:5:59)

Node.js v20.15.1
[Info - 10:25:57 AM] Connection to server got closed. Server will restart.
c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:658
er = new Error(er)
^

Error: Unexpected close tag
Line: 1886
Column: 15
Char: >
at error (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:658:10)
at strictFail (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:684:7)
at closeTag (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:878:9)
at SAXParser.write (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:1460:13)
at exports.Parser.Parser.parseString (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:323:31)
at Parser.parseString (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:5:59)
at c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:338:24
at new Promise ()
at exports.Parser.Parser.parseStringPromise (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:336:14)
at Parser.parseStringPromise (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:5:59)

Node.js v20.15.1
[Info - 10:26:09 AM] Connection to server got closed. Server will restart.
c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:658
er = new Error(er)
^

Error: Unexpected close tag
Line: 1886
Column: 15
Char: >
at error (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:658:10)
at strictFail (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:684:7)
at closeTag (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:878:9)
at SAXParser.write (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:1460:13)
at exports.Parser.Parser.parseString (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:323:31)
at Parser.parseString (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:5:59)
at c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:338:24
at new Promise ()
at exports.Parser.Parser.parseStringPromise (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:336:14)
at Parser.parseStringPromise (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:5:59)

Node.js v20.15.1
[Info - 10:26:21 AM] Connection to server got closed. Server will restart.
c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:658
er = new Error(er)
^

Error: Unexpected close tag
Line: 1886
Column: 15
Char: >
at error (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:658:10)
at strictFail (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:684:7)
at closeTag (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:878:9)
at SAXParser.write (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:1460:13)
at exports.Parser.Parser.parseString (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:323:31)
at Parser.parseString (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:5:59)
at c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:338:24
at new Promise ()
at exports.Parser.Parser.parseStringPromise (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:336:14)
at Parser.parseStringPromise (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:5:59)

Node.js v20.15.1
[Info - 10:26:33 AM] Connection to server got closed. Server will restart.
c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:658
er = new Error(er)
^

Error: Unexpected close tag
Line: 1886
Column: 15
Char: >
at error (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:658:10)
at strictFail (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:684:7)
at closeTag (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:878:9)
at SAXParser.write (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\sax\lib\sax.js:1460:13)
at exports.Parser.Parser.parseString (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:323:31)
at Parser.parseString (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:5:59)
at c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:338:24
at new Promise ()
at exports.Parser.Parser.parseStringPromise (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:336:14)
at Parser.parseStringPromise (c:\Users\yfeng.vscode\extensions\salesforce.salesforcedx-vscode-lwc-61.12.0\node_modules\xml2js\lib\parser.js:5:59)

Node.js v20.15.1
[Error - 10:26:44 AM] Connection to server got closed. Server will not be restarted.

@peternhale
Copy link
Contributor

@jean-feng would you mind opening a new issue. Thank you.

@jean-feng
Copy link

@peternhale #5869 is created

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants