Skip to content

3.7.2 — Cannot read property 'path' of undefined #35091

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 Nov 13, 2019 · 8 comments
Closed

3.7.2 — Cannot read property 'path' of undefined #35091

mjbvz opened this issue Nov 13, 2019 · 8 comments
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Nov 13, 2019

From microsoft/vscode#84171

TypeScript Version: 3.7.2

Search Terms:

  • tsserver
  • vscode

Bug
When working with an untitled file in VS Code, a user reports seeing this error:

Info 0    [10:14:32.122] Starting TS Server
Info 1    [10:14:32.122] Version: 3.7.2
Info 2    [10:14:32.122] Arguments: /usr/share/code/code /home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/typescript/lib/tsserver.js --useInferredProjectPerProjectRoot --enableTelemetry --cancellationPipeName /tmp/vscode-typescript1000/dd2b944cf07f90d02b97/tscancellation-b2a0bd347c91a0ba7aa4.tmp* --logVerbosity verbose --logFile /home/david/.config/Code/logs/20191113T100248/exthost1/vscode.typescript-language-features/tsserver-log-5rQIyx/tsserver.log --locale en --noGetErrOnBackgroundUpdate --validateDefaultNpmLocation
Info 3    [10:14:32.122] Platform: linux NodeVersion: 12 CaseSensitive: true
Info 4    [10:14:32.124] Binding...
Info 5    [10:14:32.131] request:
    {"seq":0,"type":"request","command":"configure","arguments":{"hostInfo":"vscode","preferences":{"providePrefixAndSuffixTextForRename":true,"allowRenameOfImportPath":true}}}
Info 6    [10:14:32.132] Host information vscode
Info 7    [10:14:32.132] response:
    {"seq":0,"type":"response","command":"configure","request_seq":0,"success":true}
Perf 8    [10:14:32.132] 0::configure: async elapsed time (in milliseconds) 1.0790
Info 9    [10:14:32.132] request:
    {"seq":1,"type":"request","command":"compilerOptionsForInferredProjects","arguments":{"options":{"module":"commonjs","target":"es2016","jsx":"preserve","allowJs":true,"allowSyntheticDefaultImports":true,"allowNonTsExtensions":true}}}
Info 10   [10:14:32.133] Scheduled: *ensureProjectForOpenFiles*
Perf 11   [10:14:32.133] 1::compilerOptionsForInferredProjects: elapsed time (in milliseconds) 0.5926
Info 12   [10:14:32.133] response:
    {"seq":0,"type":"response","command":"compilerOptionsForInferredProjects","request_seq":1,"success":true,"body":true}
Info 13   [10:14:32.133] request:
    {"seq":2,"type":"request","command":"updateOpen","arguments":{"changedFiles":[],"closedFiles":[],"openFiles":[{"file":"untitled:Untitled-1","fileContent":"le","projectRootPath":"/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB","scriptKindName":"TS"}]}}
Info 14   [10:14:32.134] Search path: 
Info 15   [10:14:32.135] ConfigFilePresence:: Current Watches: :: File: tsconfig.json Currently impacted open files: RootsOfInferredProjects:  OtherOpenFiles: untitled:Untitled-1 Status: File added to open files impacted by this config file
Info 16   [10:14:32.135] For info: untitled:Untitled-1 :: Config file name: tsconfig.json
Info 17   [10:14:32.135] Opened configuration file tsconfig.json
Info 18   [10:14:32.136] FileWatcher:: Added:: WatchInfo: tsconfig.json 2000 Project: tsconfig.json WatchType: Config file
Info 19   [10:14:32.137] event:
    {"seq":0,"type":"event","event":"projectLoadingStart","body":{"projectName":"tsconfig.json","reason":"Creating possible configured project for untitled:Untitled-1 to open"}}
Info 20   [10:14:32.151] Config: tsconfig.json : {
 "rootNames": [
  "src/app.ts",
  "src/game-data-interface.ts",
  "src/entities/base-class.ts",
  "src/entities/bitmap-character.ts",
  "src/entities/bullet.ts",
  "src/entities/character.ts",
  "src/entities/factory.ts",
  "src/entities/graves.ts",
  "src/entities/hero.ts",
  "src/entities/text.ts",
  "src/entities/vector-character.ts",
  "src/entities/zombie.ts",
  "src/states/base-class.ts",
  "src/states/game-over.ts",
  "src/states/global-state.ts",
  "src/states/init.ts",
  "src/states/level-one.ts",
  "src/states/level-two.ts",
  "src/states/start-screen.ts",
  "src/utilities/assert.ts",
  "src/utilities/collision-detection.ts",
  "src/utilities/http-service.ts",
  "src/utilities/loader.ts",
  "src/utilities/new-collision-detection.ts",
  "src/utilities/random.ts",
  "src/utilities/tween.ts",
  "src/utilities/vector-example.ts",
  "src/utilities/vectors.ts",
  "test/app-test.ts"
 ],
 "options": {
  "target": 6,
  "module": 5,
  "sourceMap": true,
  "strict": true,
  "moduleResolution": 2,
  "esModuleInterop": true,
  "resolveJsonModule": true,
  "configFilePath": "tsconfig.json"
 }
}
Info 21   [10:14:32.151] DirectoryWatcher:: Added:: WatchInfo: src 1 Project: tsconfig.json WatchType: Wild card directory
Info 22   [10:14:32.153] Elapsed:: 2ms DirectoryWatcher:: Added:: WatchInfo: src 1 Project: tsconfig.json WatchType: Wild card directory
Info 23   [10:14:32.153] DirectoryWatcher:: Added:: WatchInfo: test 1 Project: tsconfig.json WatchType: Wild card directory
Info 24   [10:14:32.153] Elapsed:: 0ms DirectoryWatcher:: Added:: WatchInfo: test 1 Project: tsconfig.json WatchType: Wild card directory
Err 25    [10:14:32.165] Exception on executing command {"seq":2,"type":"request","command":"updateOpen","arguments":{"changedFiles":[],"closedFiles":[],"openFiles":[{"file":"untitled:Untitled-1","fileContent":"le","projectRootPath":"/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB","scriptKindName":"TS"}]}}:

    Cannot read property 'path' of undefined

    TypeError: Cannot read property 'path' of undefined
        at ProjectService.updateNonInferredProjectFiles (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:137385:43)
        at ProjectService.addFilesToNonInferredProject (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:137275:22)
        at ProjectService.updateRootAndOptionsOfNonInferredProject (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:137423:22)
        at ProjectService.loadConfiguredProject (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:137359:22)
        at ProjectService.createAndLoadConfiguredProject (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:137299:22)
        at ProjectService.createLoadAndUpdateConfiguredProject (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:137304:36)
        at ProjectService.assignProjectToOpenedScriptInfo (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:138127:44)
        at /home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:138358:107
        at Object.mapDefined (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:565:30)
        at ProjectService.applyChangesInOpenFiles (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:138358:48)
        at Session.handlers.ts.createMapFromTemplate._a.<computed> (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:139212:46)
        at /home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:140870:88
        at IOSession.Session.executeWithRequestId (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:140861:28)
        at IOSession.Session.executeCommand (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:140870:33)
        at IOSession.Session.onMessage (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:140893:35)
        at Interface.<anonymous> (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:142208:27)
        at Interface.emit (events.js:200:13)
        at Interface._onLine (readline.js:314:10)
        at Interface._normalWrite (readline.js:459:12)
        at Socket.ondata (readline.js:170:10)
        at Socket.emit (events.js:200:13)
        at addChunk (_stream_readable.js:294:12)
        at readableAddChunk (_stream_readable.js:275:11)
        at Socket.Readable.push (_stream_readable.js:210:10)
        at Pipe.onStreamRead (internal/stream_base_commons.js:166:17)
Info 26   [10:14:32.165] response:
    {"seq":0,"type":"response","command":"updateOpen","request_seq":2,"success":false,"message":"Error processing request. Cannot read property 'path' of undefined\nTypeError: Cannot read property 'path' of undefined\n    at ProjectService.updateNonInferredProjectFiles (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:137385:43)\n    at ProjectService.addFilesToNonInferredProject (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:137275:22)\n    at ProjectService.updateRootAndOptionsOfNonInferredProject (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:137423:22)\n    at ProjectService.loadConfiguredProject (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:137359:22)\n    at ProjectService.createAndLoadConfiguredProject (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:137299:22)\n    at ProjectService.createLoadAndUpdateConfiguredProject (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:137304:36)\n    at ProjectService.assignProjectToOpenedScriptInfo (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:138127:44)\n    at /home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:138358:107\n    at Object.mapDefined (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:565:30)\n    at ProjectService.applyChangesInOpenFiles (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:138358:48)\n    at Session.handlers.ts.createMapFromTemplate._a.<computed> (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:139212:46)\n    at /home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:140870:88\n    at IOSession.Session.executeWithRequestId (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:140861:28)\n    at IOSession.Session.executeCommand (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:140870:33)\n    at IOSession.Session.onMessage (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:140893:35)\n    at Interface.<anonymous> (/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB/node_modules/.pnpm/registry.npmjs.org/typescript/3.7.2/node_modules/typescript/lib/tsserver.js:142208:27)\n    at Interface.emit (events.js:200:13)\n    at Interface._onLine (readline.js:314:10)\n    at Interface._normalWrite (readline.js:459:12)\n    at Socket.ondata (readline.js:170:10)\n    at Socket.emit (events.js:200:13)\n    at addChunk (_stream_readable.js:294:12)\n    at readableAddChunk (_stream_readable.js:275:11)\n    at Socket.Readable.push (_stream_readable.js:210:10)\n    at Pipe.onStreamRead (internal/stream_base_commons.js:166:17)"}
Info 27   [10:14:32.166] event:
    {"seq":0,"type":"event","event":"typingsInstallerPid","body":{"pid":6694}}
Info 28   [10:14:32.167] request:
    {"seq":3,"type":"request","command":"updateOpen","arguments":{"changedFiles":[],"closedFiles":[],"openFiles":[{"file":"untitled:^Untitled-1","fileContent":"","projectRootPath":"/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB","scriptKindName":"TS"}]}}

Since VS code 1.40, we treat all errors in updateOpen as fatal so we restart the server at this point (and promptly crash again)

This is a very similar error to #35001 but the user does not appear to have tslint installed (TSLint logs quite a bit and we also don't see any plugin load requests)

/cc @sheetalkamat

@mjbvz
Copy link
Contributor Author

mjbvz commented Nov 13, 2019

@David-Else Thank you for testing this and collecting the logs. That error definitely would explain the errors you are seeing in VS Code. I've moved the issue over the to TypeScript repo for further follow up

@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Nov 13, 2019
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 3.7.3 milestone Nov 13, 2019
mjbvz added a commit to microsoft/vscode that referenced this issue Nov 14, 2019
Some users are setting weird errors related to untitled TS files. In some of these cases (such as microsoft/TypeScript#35091) we see a untitled file being sent to the tsserver without the `inMemoryResourcePrefix`.

I can't figure out how to get into this state but am removing the gating that *could* perhaps cause use not to set `inMemoryResourcePrefix`. This gating targets TS 2.7 or older, which telemetry shows very, very few users are still enabling in their workspaces
@sheetalkamat sheetalkamat added the Fix Available A PR has been opened for this issue label Nov 14, 2019
@sheetalkamat
Copy link
Member

  {"seq":2,"type":"request","command":"updateOpen","arguments":{"changedFiles":[],"closedFiles":[],"openFiles":[{"file":"untitled:Untitled-1","fileContent":"le","projectRootPath":"/home/david/sites/TypeScript/typescript-zombie-attack-GITHUB","scriptKindName":"TS"}]}}

@mjbvz The main issue here is that there is no ^ on file and hence its not treated as dynamic file name. But even with that, we shouldn't be looking for config files for dynamic files.. Fixed that part in #35111

@mjbvz
Copy link
Contributor Author

mjbvz commented Nov 14, 2019

Thanks. The missing ^ should be fixed in the current VS Code insiders builds. There was a bug in VS Code that could cause the ^ to be dropped if the file was opened during a server restart

@PaunCostin
Copy link

Thanks. The missing ^ should be fixed in the current VS Code insiders builds. There was a bug in VS Code that could cause the ^ to be dropped if the file was opened during a server restart

I still got the error in the insiders build, version 1.41.0-insiders

@atreidesend
Copy link

Thanks. The missing ^ should be fixed in the current VS Code insiders builds. There was a bug in VS Code that could cause the ^ to be dropped if the file was opened during a server restart

I still got the error in the insiders build, version 1.41.0-insiders

same here

@OogieBoogieInJSON
Copy link

OogieBoogieInJSON commented Dec 3, 2019

In 1.40.2 I still have the same error, TS language can't start.

Later edit: So I went over and disabled all extensions and then re-enabled one by one. GitLens extension was causing the TS language server to crash for some reason.

Later later edit: Line and file annonations from GitLens seem to be the problem. I've disabled them from extension's settings and now the language server starts correctly. This annotation seem to be a performance hit as well for the quick suggetions.

@micsco
Copy link

micsco commented Dec 8, 2019

Just to add to this, I see similar symptoms and a resolution after disabling GitLens when using TS 3.7.2.

@David-Else
Copy link

David-Else commented Jan 15, 2020

@sheetalkamat Please re-open this.

This error is NOT fixed using 1.41.1 AND JavaScript and TypeScript Nightly extension TS 3.8.0-dev.20200114 or with the new insiders. I opened a new issue, but it might be a different problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

No branches or pull requests

8 participants