Typescript: Debug Failure. Symbol parent was undefined.

Created on 16 Sep 2020  路  12Comments  路  Source: microsoft/TypeScript

TS Template added by @mjbvz

TypeScript Version: 4.1.0-dev.20200921

Search Terms

  • Completion
  • suggestions




  • VSCode Version: 1.49.0 (user setup)
  • OS Version: Windows_NT x64 10.0.19041

Steps to Reproduce:

In any *.ts or *.js file, when I try to use auto-completion for eg console by typing con and then pressing [STRG]+[SPACE] I'm not prompted with the expected console. However: once I completed typing console I get suggestions for console's members.

Looking at the "Log (Extension Host)" I see the following error:

[2020-09-16 04:49:13.048] [exthost] [error] [vscode.typescript-language-features] provider FAILED
[2020-09-16 04:49:13.049] [exthost] [error] Error: <semantic> TypeScript Server Error (4.0.2)
Debug Failure. Symbol parent was undefined. Flags: ExportDoesNotSupportDefaultModifier|Alias|AliasExcludes|ModuleMember|Classifiable|Transient. Declarations: undefined.
Error: Debug Failure. Symbol parent was undefined. Flags: ExportDoesNotSupportDefaultModifier|Alias|AliasExcludes|ModuleMember|Classifiable|Transient. Declarations: undefined.
    at getSymbolParentOrFail (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:113347:25)
    at Object.getNameForExportedSymbol (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:113340:61)
    at pushSymbol (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:116339:40)
    at c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:116323:28
    at Map.forEach (<anonymous>)
    at getSymbolsFromOtherSourceFileExports (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:116321:54)
    at getGlobalCompletions (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:116082:49)
    at tryGetGlobalSymbols (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:115993:25)
    at getCompletionData (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:115787:22)
    at Object.getCompletionsAtPosition (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:115129:34)
    at Proxy.getCompletionsAtPosition (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:143481:35)
    at IOSession.Session.getCompletions (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:154320:64)
    at Session.handlers.ts.Map.ts.getEntries._a.<computed> (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:153204:61)
    at c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:154953:88
    at IOSession.Session.executeWithRequestId (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:154944:28)
    at IOSession.Session.executeCommand (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:154953:33)
    at IOSession.Session.onMessage (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:154977:35)
    at Interface.<anonymous> (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:157193:27)
    at Interface.emit (events.js:223:5)
    at Interface._onLine (readline.js:315:10)
    at Interface._normalWrite (readline.js:460:12)
    at Socket.ondata (readline.js:172:10)
    at Socket.emit (events.js:223:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:181:23)
    at Function.create (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\typescript-language-features\dist\extension.js:1:76465)
    at h.dispatchResponse (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\typescript-language-features\dist\extension.js:1:70340)
    at h.dispatchMessage (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\typescript-language-features\dist\extension.js:1:69199)
    at c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\typescript-language-features\dist\extension.js:1:68709
    at l.fire (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:46:475)
    at g.onLengthData (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\typescript-language-features\dist\extension.js:45:60018)
    at Socket.<anonymous> (c:\Users\henning\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\typescript-language-features\dist\extension.js:45:59666)
    at Socket.emit (events.js:223:5)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:290:11)
    at Socket.Readable.push (_stream_readable.js:224:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:181:23)

However: for a split second, this seems to work alright - maybe before the internal initialization of some vscode routine complete?


Does this issue occur when all extensions are disabled?: Yes

Bug Crash Completion Lists Fix Available

Most helpful comment

It seems this issue https://github.com/microsoft/TypeScript/issues/40355 is related. I a little bit investigated it and ran into this crash. I used the following test to reproduce the issue

/// <reference path='fourslash.ts'/>

// @esModuleInterop: true
// @moduleResolution: node
// @target: es2015
// @module: esnext

// @Filename: /node_modules/@bar/foo/index.d.ts
//// export = Foo;
//// declare class Foo {}
//// declare namespace Foo {}  // class/namespace declaration causes the issue

// @Filename: /node_modules/foo/index.d.ts
//// import * as Foo from "@bar/foo";
//// export = Foo;

// @Filename: /index.ts
//// import Foo from "foo";
//// /**/

goTo.file("/index.ts");
verify.completions({
    marker: "",
    includes: ["Foo"],
    preferences: {
        includeCompletionsForModuleExports: true
    }
});
Error: Debug Failure. Symbol parent was undefined. Flags: ExportDoesNotSupportDefaultModifier|Alias|AliasExcludes|ModuleMember|Classifiable|Transient. Declarations: undefined.
      at getSymbolParentOrFail (src/services/utilities.ts:2885:22)
      at Object.getNameForExportedSymbol (src/services/utilities.ts:2879:58)
      at pushSymbol (src/services/completions.ts:1727:33)
      at /TypeScript/src/services/completions.ts:1711:106
      at Map.forEach (<anonymous>)
      at getSymbolsFromOtherSourceFileExports (src/services/completions.ts:1711:50)
     ...

At first glance, the crash occurs because of resolvedModuleSymbol returns symbol without a parent, which is required in getSymbolParentOrFail.

https://github.com/microsoft/TypeScript/blob/7c6462aa10329884618c51ff9af76c66b503f47c/src/services/completions.ts#L1658

https://github.com/microsoft/TypeScript/blob/7c6462aa10329884618c51ff9af76c66b503f47c/src/services/completions.ts#L1727

https://github.com/microsoft/TypeScript/blob/7c6462aa10329884618c51ff9af76c66b503f47c/src/services/utilities.ts#L2879

cc @DanielRosenwasser @sheetalkamat

All 12 comments

None of the suggested "duplicates" seem to be related to code-completion.

Can you share the project or at least the file the caused this error?

I've create a stripped version of one of my projects, where this behavior occurs. You can check it out at https://github.com/nyn3x/vscode-autocomplete-error

If you go to the Home.tsx and try to access the imported log function typing just lo doesn't offer the imported log function; instead I get the error shown above.

Thanks. I confirmed the crash.

Here's the stack from TypeScript 4.1.0-dev.20200921:

<semantic> TypeScript Server Error (4.1.0-dev.20200921)
Debug Failure. Symbol parent was undefined. Flags: ExportDoesNotSupportDefaultModifier|Alias|AliasExcludes|ModuleMember|Classifiable|Transient. Declarations: undefined.
Error: Debug Failure. Symbol parent was undefined. Flags: ExportDoesNotSupportDefaultModifier|Alias|AliasExcludes|ModuleMember|Classifiable|Transient. Declarations: undefined.
    at getSymbolParentOrFail (/Users/matb/projects/san/vscode-autocomplete-error/node_modules/typescript/lib/tsserver.js:114958:25)
    at Object.getNameForExportedSymbol (/Users/matb/projects/san/vscode-autocomplete-error/node_modules/typescript/lib/tsserver.js:114951:61)
    at pushSymbol (/Users/matb/projects/san/vscode-autocomplete-error/node_modules/typescript/lib/tsserver.js:118252:40)
    at /Users/matb/projects/san/vscode-autocomplete-error/node_modules/typescript/lib/tsserver.js:118236:28
    at Map.forEach (<anonymous>)
    at getSymbolsFromOtherSourceFileExports (/Users/matb/projects/san/vscode-autocomplete-error/node_modules/typescript/lib/tsserver.js:118234:54)
    at getGlobalCompletions (/Users/matb/projects/san/vscode-autocomplete-error/node_modules/typescript/lib/tsserver.js:117995:49)
    at tryGetGlobalSymbols (/Users/matb/projects/san/vscode-autocomplete-error/node_modules/typescript/lib/tsserver.js:117906:25)
    at getCompletionData (/Users/matb/projects/san/vscode-autocomplete-error/node_modules/typescript/lib/tsserver.js:117693:22)
    at Object.getCompletionsAtPosition (/Users/matb/projects/san/vscode-autocomplete-error/node_modules/typescript/lib/tsserver.js:117013:34)
    at Proxy.getCompletionsAtPosition (/Users/matb/projects/san/vscode-autocomplete-error/node_modules/typescript/lib/tsserver.js:145573:35)
    at Proxy.<anonymous> (/Users/matb/.vscode-insiders/extensions/jpoissonnier.vscode-styled-components-0.0.31/node_modules/typescript-template-language-service-decorator/lib/template-language-service-decorator.js:84:24)
    at IOSession.Session.getCompletions (/Users/matb/projects/san/vscode-autocomplete-error/node_modules/typescript/lib/tsserver.js:156424:64)
    at Session.handlers.ts.Map.ts.getEntries._a.<computed> (/Users/matb/projects/san/vscode-autocomplete-error/node_modules/typescript/lib/tsserver.js:155308:61)
    at /Users/matb/projects/san/vscode-autocomplete-error/node_modules/typescript/lib/tsserver.js:157058:88
    at IOSession.Session.executeWithRequestId (/Users/matb/projects/san/vscode-autocomplete-error/node_modules/typescript/lib/tsserver.js:157049:28)
    at IOSession.Session.executeCommand (/Users/matb/projects/san/vscode-autocomplete-error/node_modules/typescript/lib/tsserver.js:157058:33)
    at IOSession.Session.onMessage (/Users/matb/projects/san/vscode-autocomplete-error/node_modules/typescript/lib/tsserver.js:157082:35)
    at Interface.<anonymous> (/Users/matb/projects/san/vscode-autocomplete-error/node_modules/typescript/lib/tsserver.js:159298:27)
    at Interface.emit (events.js:223:5)
    at Interface._onLine (readline.js:315:10)

It seems this issue https://github.com/microsoft/TypeScript/issues/40355 is related. I a little bit investigated it and ran into this crash. I used the following test to reproduce the issue

/// <reference path='fourslash.ts'/>

// @esModuleInterop: true
// @moduleResolution: node
// @target: es2015
// @module: esnext

// @Filename: /node_modules/@bar/foo/index.d.ts
//// export = Foo;
//// declare class Foo {}
//// declare namespace Foo {}  // class/namespace declaration causes the issue

// @Filename: /node_modules/foo/index.d.ts
//// import * as Foo from "@bar/foo";
//// export = Foo;

// @Filename: /index.ts
//// import Foo from "foo";
//// /**/

goTo.file("/index.ts");
verify.completions({
    marker: "",
    includes: ["Foo"],
    preferences: {
        includeCompletionsForModuleExports: true
    }
});
Error: Debug Failure. Symbol parent was undefined. Flags: ExportDoesNotSupportDefaultModifier|Alias|AliasExcludes|ModuleMember|Classifiable|Transient. Declarations: undefined.
      at getSymbolParentOrFail (src/services/utilities.ts:2885:22)
      at Object.getNameForExportedSymbol (src/services/utilities.ts:2879:58)
      at pushSymbol (src/services/completions.ts:1727:33)
      at /TypeScript/src/services/completions.ts:1711:106
      at Map.forEach (<anonymous>)
      at getSymbolsFromOtherSourceFileExports (src/services/completions.ts:1711:50)
     ...

At first glance, the crash occurs because of resolvedModuleSymbol returns symbol without a parent, which is required in getSymbolParentOrFail.

https://github.com/microsoft/TypeScript/blob/7c6462aa10329884618c51ff9af76c66b503f47c/src/services/completions.ts#L1658

https://github.com/microsoft/TypeScript/blob/7c6462aa10329884618c51ff9af76c66b503f47c/src/services/completions.ts#L1727

https://github.com/microsoft/TypeScript/blob/7c6462aa10329884618c51ff9af76c66b503f47c/src/services/utilities.ts#L2879

cc @DanielRosenwasser @sheetalkamat

I can confirm I'm having the same problem with TypeScript v.4.0.x in my VSCode. I have to stick to v.3.9.7 for now unless there's a workaround?

Hmm - but that doesn't seem to work for me. I changed in the package.json the typescript to "^3.9.7" and then set the typescript-sdk to the local workspace. But still I get

[2020-09-24 10:01:54.221] [exthost] [error] [vscode.typescript-language-features] provider FAILED
[2020-09-24 10:01:54.222] [exthost] [error] Error: <semantic> TypeScript Server Error (3.9.7)
Debug Failure.
Error: Debug Failure.
    at Object.getNameForExportedSymbol (C:\projects\playground\vscode-ts-error\broken\node_modules\.pnpm\[email protected]\node_modules\typescript\lib\tsserver.js:110423:70)

Hmm - but that doesn't seem to work for me. I changed in the package.json the typescript to "^3.9.7" and then set the typescript-sdk to the local workspace. But still I get

Hmm... interesting, 3.9.7 works for me, it doesn't throw that error and the suggestions work. Interestingly, when I tried a fresh project (I use Next.js), there was no error at all with 4.0.2, so I'm suspecting one of the dependencies in my project may be causing that issue...

maybe - I did upload a sample-project, which shows this error ...

It seems that "esModuleInterop": true in the tsconfig.json is causing this error. Switching this to false seems to remove this error.

However - why did I include this setting in my project? I guess it was, so I don't get errors when doing import React from "react"; as I didn't want to write import * as React from "react";

The problem is in "esModuleInterop": true I try with all TypeScript versions but all with same error.
Disabling esModuleInterop all work fine

I'm having the same problem with a nextJS project. When i disable esModuleInterop it works.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

metaweta picture metaweta  路  140Comments

nitzantomer picture nitzantomer  路  135Comments

rbuckton picture rbuckton  路  139Comments

born2net picture born2net  路  150Comments

kimamula picture kimamula  路  147Comments