Skip to content

TS Server error after deleting jsconfig.json #30005

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

Closed
mjbvz opened this issue Feb 20, 2019 · 7 comments
Closed

TS Server error after deleting jsconfig.json #30005

mjbvz opened this issue Feb 20, 2019 · 7 comments
Assignees
Labels
Bug A bug in TypeScript Duplicate An existing issue was already created Help Wanted You can do this VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Feb 20, 2019

From microsoft/vscode#68428

TypeScript Version: 3.4.0-dev.20190220

Search Terms:

  • projectLoadingStart
  • projectLoadingFinish

Code
Follow instructions in microsoft/vscode#68428

Bug
After deleting the jsconfig, see this error in the server logs:

Info 433  [14:12:22.825] request:
    {"seq":26,"type":"request","command":"reloadProjects","arguments":null}
Info 434  [14:12:22.826] reload projects.
Info 435  [14:12:22.826] Search path: /Users/matb/projects/san
Info 436  [14:12:22.826] For info: /Users/matb/projects/san/index.js :: Config file name: /Users/matb/projects/san/jsconfig.json
Info 437  [14:12:22.826] Reloading configured project /Users/matb/projects/san/jsconfig.json
Info 438  [14:12:22.826] event:
    {"seq":0,"type":"event","event":"projectLoadingStart","body":{"projectName":"/Users/matb/projects/san/jsconfig.json","reason":"User requested reload projects"}}
Err 439   [14:12:22.827] Exception on executing command {"seq":26,"type":"request","command":"reloadProjects","arguments":null}:

    Cannot read property 'length' of undefined

    TypeError: Cannot read property 'length' of undefined
        at createSourceFile (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:17172:110)
        at Object.parseJsonText (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:17006:26)
        at Object.parseJsonText (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:16828:23)
        at ProjectService.loadConfiguredProject (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:124433:33)
        at ProjectService.reloadConfiguredProject (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:124536:22)
        at /Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:124992:39
        at Map.forEach (<anonymous>)
        at ProjectService.reloadConfiguredProjectForFiles (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:124976:27)
        at ProjectService.reloadProjects (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:124964:22)
        at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:126124:46)
        at /Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:127490:88
        at IOSession.Session.executeWithRequestId (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:127481:28)
        at IOSession.Session.executeCommand (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:127490:33)
        at IOSession.Session.onMessage (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:127512:35)
        at Interface.<anonymous> (/Users/matb/projects/san/node_modules/typescript/lib/tsserver.js:128773:27)
        at Interface.emit (events.js:182:13)
        at Interface._onLine (readline.js:290:10)
        at Interface._normalWrite (readline.js:433:12)
        at Socket.ondata (readline.js:149:10)
        at Socket.emit (events.js:182:13)
        at addChunk (_stream_readable.js:279:12)
        at readableAddChunk (_stream_readable.js:264:11)
        at Socket.Readable.push (_stream_readable.js:219:10)
        at Pipe.onread (net.js:636:20)

Here's the full logs: tsserver.log.zip

(note for these logs I had to create and delete the jsconfig twice. The second delete triggered the error)

@mjbvz
Copy link
Contributor Author

mjbvz commented Feb 20, 2019

@sheetalkamat VS Code sends reloadProject requests when we detect the creation or deletion of jsconfig files. Are these still needed for files on disk, or will the watcher handle ts/jsconfig file changes properly?

@sheetalkamat
Copy link
Member

we already watch jsconfig files for all the open files so reload project should be unnecessary

@mjbvz
Copy link
Contributor Author

mjbvz commented Feb 21, 2019

Thanks. I'm going to remove the reloadProject calls then. Once those are removed, I don't think we will hit this error anymore but I'll double check

mjbvz added a commit to microsoft/vscode that referenced this issue Feb 21, 2019
The TypeScript Server should be watching these files already so we do not need to tell it to 'reloadProjects'. In the current case, 'reloadProjects' is causing a TS Server error

microsoft/TypeScript#30005

Fixes #68428
@mjbvz
Copy link
Contributor Author

mjbvz commented Feb 21, 2019

Ok, I confirmed that after removing the reloadProjects call, we don't see this error anymore. Up to you if this crash still needs to be fixed or not

sandy081 pushed a commit to vldmrkl/vscode that referenced this issue Feb 22, 2019
The TypeScript Server should be watching these files already so we do not need to tell it to 'reloadProjects'. In the current case, 'reloadProjects' is causing a TS Server error

microsoft/TypeScript#30005

Fixes microsoft#68428
@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this labels Feb 27, 2019
@RyanCavanaugh RyanCavanaugh added this to the Community milestone Feb 27, 2019
@RyanCavanaugh RyanCavanaugh modified the milestones: Community, Backlog Mar 7, 2019
@minestarks
Copy link
Member

minestarks commented Dec 17, 2019

This still impacts the configure and applyChangedToOpenFiles commands in VS on a regular basis: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1044424
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1044406

@mjbvz mjbvz added the VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone label Apr 15, 2020
@RyanCavanaugh RyanCavanaugh modified the milestones: Backlog, TypeScript 4.0 Apr 15, 2020
@minestarks
Copy link
Member

@sheetalkamat @RyanCavanaugh @mjbvz is this not a dupe of #36862?

@sheetalkamat
Copy link
Member

@minestarks Thank you this is dulpicate of #36862

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Duplicate An existing issue was already created Help Wanted You can do this VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone
Projects
None yet
Development

No branches or pull requests

4 participants