Skip to content

Debug Failure. Symbol parent was undefined. #40684

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
nyn3x opened this issue Sep 16, 2020 · 12 comments · Fixed by #41282
Closed

Debug Failure. Symbol parent was undefined. #40684

nyn3x opened this issue Sep 16, 2020 · 12 comments · Fixed by #41282
Assignees
Labels
Bug A bug in TypeScript Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output Domain: Completion Lists The issue relates to showing completion lists in an editor Fix Available A PR has been opened for this issue

Comments

@nyn3x
Copy link

nyn3x commented Sep 16, 2020

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

@nyn3x
Copy link
Author

nyn3x commented Sep 16, 2020

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

@mjbvz
Copy link
Contributor

mjbvz commented Sep 16, 2020

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

@nyn3x
Copy link
Author

nyn3x commented Sep 20, 2020

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.

@mjbvz mjbvz transferred this issue from microsoft/vscode Sep 21, 2020
@mjbvz
Copy link
Contributor

mjbvz commented Sep 21, 2020

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)

@mjbvz mjbvz removed their assignment Sep 21, 2020
@mjbvz mjbvz changed the title No Code AutoCompletion Debug Failure. Symbol parent was undefined. Sep 21, 2020
@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output Domain: Completion Lists The issue relates to showing completion lists in an editor labels Sep 22, 2020
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 4.1.1 milestone Sep 22, 2020
@a-tarasyuk
Copy link
Contributor

a-tarasyuk commented Sep 22, 2020

It seems this issue #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.

const resolvedModuleSymbol = typeChecker.resolveExternalModuleSymbol(moduleSymbol);

symbolName: getNameForExportedSymbol(symbol, target),

|| codefix.moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget);

cc @DanielRosenwasser @sheetalkamat

@chermme
Copy link

chermme commented Sep 24, 2020

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?

@nyn3x
Copy link
Author

nyn3x commented Sep 24, 2020

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)

@chermme
Copy link

chermme commented Sep 24, 2020

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...

@nyn3x
Copy link
Author

nyn3x commented Sep 24, 2020

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";

@carmas123
Copy link

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

@lorenzorapetti
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Crash For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output Domain: Completion Lists The issue relates to showing completion lists in an editor Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants