Skip to content

TS Server fatal error: Cannot read property 'lastIndexOf' of undefined #119684

Closed
@a-matusewicz

Description

@a-matusewicz

Issue Type: Bug

❗️❗️❗️ Please fill in the sections below to help us diagnose the issue ❗️❗️❗️

TypeScript Version: 4.2.3

Steps to reproduce crash

  1. Duplicate of "Cannot read property 'lastIndexOf' of undefined" error in tsserver.js TypeScript#43105
  2. Reporting for scope

TS Server Log
❗️Server logging disabled. To help us fix crashes like this, please enable logging by setting:

"typescript.tsserver.log": "verbose"

After enabling this setting, future crash reports will include the server log.

TS Server Error Stack
Server: semantic

TypeError: Cannot read property 'lastIndexOf' of undefined
    at Object.startsWith (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:2024:20)
    at isNodeModulesOrScopedPackageDirectory (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:19068:65)
    at guessDirectorySymlink (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:19056:17)
    at Object.discoverProbableSymlinks (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:19044:22)
    at ConfiguredProject.Project.getSymlinkCache (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:153461:61)
    at Object.getSymlinkCache (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:108825:29)
    at fileOrDirectoryExistsUsingSource (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:108956:37)
    at Object.host.compilerHost.directoryExists (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:108868:24)
    at Object.directoryProbablyExists (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:18100:46)
    at c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:39096:46
    at Object.firstDefined (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:220:26)
    at primaryLookup (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:39093:27)
    at Object.resolveTypeReferenceDirective (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:39066:24)
    at c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:154817:112
    at Object.map (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:451:29)
    at Function.AutoImportProviderProject.getRootFileNames (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:154817:42)
    at Function.AutoImportProviderProject.create (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:154846:38)
    at ConfiguredProject.Project.getPackageJsonAutoImportProvider (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:154660:77)
    at ConfiguredProject.Project.updateGraph (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:154058:26)
    at ConfiguredProject.updateGraph (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:154993:63)
    at ProjectService.createLoadAndUpdateConfiguredProject (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:156743:25)
    at ProjectService.assignProjectToOpenedScriptInfo (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:157684:44)
    at c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:158024:97
    at Object.flatMap (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:515:25)
    at ProjectService.applyChangesInOpenFiles (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:158024:41)
    at Session.handlers.ts.Map.ts.getEntries._a.<computed> (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:159079:46)
    at c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:160963:88
    at IOSession.Session.executeWithRequestId (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:160954:28)
    at IOSession.Session.executeCommand (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:160963:33)
    at IOSession.Session.onMessage (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:160989:35)
    at Interface.<anonymous> (c:\Users\anmatuse\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:163650:31)
    at Interface.emit (events.js:315:20)
    at Interface._onLine (readline.js:329:10)
    at Interface._normalWrite (readline.js:474:12)
    at Socket.ondata (readline.js:186:10)
    at Socket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
    at Socket.Readable.push (_stream_readable.js:212:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:186:23)

VS Code version: Code 1.54.3 (2b9aebd, 2021-03-15T10:55:45.459Z)
OS version: Windows_NT x64 10.0.19042

System Info
Item Value
CPUs Intel(R) Xeon(R) W-2133 CPU @ 3.60GHz (12 x 3600)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 63.59GB (53.04GB free)
Process Argv --crash-reporter-id a540cb69-1e01-447d-b23e-d8ed85b33ca9
Screen Reader no
VM 0%
Extensions (3)
Extension Author (truncated) Version
vscode-eslint dba 2.1.19
vsliveshare ms- 1.0.4018
code-spell-checker str 1.10.2
A/B Experiments
vsins829:30139715
vsliv368:30146709
vsreu685:30147344
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt875:30259475
vspre833:30267464
vsdfh931:30275552
vshan820:30276952

Metadata

Metadata

Assignees

No one assigned

    Labels

    *duplicateIssue identified as a duplicate of another issue(s)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions