Skip to content

TypeError in Svelte Language Server (VS Code Extension) #2864

@lecramr

Description

@lecramr

Describe the bug

Description:
The Svelte Language Server crashes repeatedly during initialization when working with a multi-app TypeScript monorepo setup. The crash occurs in the TypeScript service cleanup phase (cleanupSemanticCache) due to an undefined registry entry.

Environment

  • Svelte Language Server version: svelte.svelte-vscode-109.11.1
  • VS Code version: (latest stable at time of issue)
  • Node.js version: v22.18.0
  • Operating System: macOS
  • Project setup: Multi-app monorepo using multiple Svelte and TypeScript configurations

Example:

  • /apps/frontend
  • /apps/designer
  • /apps/qrcode
  • /packages/shared

Logs / Stacktrace

Initialize language server at  file:///Users/<username>/Desktop/<projectname>/apps/frontend, file:///Users/<username>/Desktop/<projectname>/apps/designer, file:///Users/<username>/Desktop/<projectname>/apps/qrcode, file:///Users/<username>/Desktop/<projectname>/packages
Initialize new ts service at  /Users/<username>/Desktop/<projectname>/apps/frontend/tsconfig.json
Trying to load configs for /Users/<username>/Desktop/<projectname>/apps/frontend
Loaded config at  /Users/<username>/Desktop/<projectname>/apps/frontend/svelte.config.js
SnapshotManager File Statistics:
Project files: 866
Svelte files: 455
From node_modules: 0
Total: 866
/Users/<username>/.vscode/extensions/svelte.svelte-vscode-109.11.1/node_modules/typescript/lib/typescript.js:143850
  return !!entry.sourceFile;
                 ^

TypeError: Cannot read properties of undefined (reading 'sourceFile')
    at isDocumentRegistryEntry (typescript.js:143850:18)
    at getDocumentRegistryEntry (typescript.js:143926:19)
    at Object.releaseDocumentWithKey (typescript.js:144021:19)
    at typescript.js:152976:65
    at forEach (typescript.js:2305:22)
    at cleanupSemanticCache (typescript.js:152976:7)
    at Object.dispose (typescript.js:152981:5)
    at Object.dispose (service.js:630:25)
    at service.js:962:33
    at async Promise.all (index 0)

Node.js v22.18.0
[Error - 4:49:06 PM] Server process exited with code 1.
[Error - 4:49:06 PM] The Svelte server crashed 5 times in the last 3 minutes. The server will not be restarted.

Reproduction

Example Structure:

  • /apps/frontend
  • /apps/designer
  • /apps/qrcode
  • /packages/shared

Expected behaviour

Well, to not crash :)

System Info

Environment

  • Svelte Language Server version: svelte.svelte-vscode-109.11.1
  • VS Code version: (latest stable at time of issue)
  • Node.js version: v22.18.0
  • Operating System: macOS
  • Project setup: Multi-app monorepo using multiple Svelte and TypeScript configurations

Which package is the issue about?

Svelte for VS Code extension

Additional Information, eg. Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions