question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Poor error message when names conflict

See original GitHub issue

TypeScript Version: 3.5.2

Search Terms: debug failure unexpected node error message exception

Obviously the following code is incorrect, however I would expect a friendly error message directing the user to the problem, rather than the nasty/ambiguous error message that is currently given: Error: Debug Failure. Unexpected node.

I ran into this in a large codebase and it took me awhile to find source of the problem.

Code

yarn add @types/lodash
import * as pick from 'lodash/pick';

export const pick = () => pick();
$ tsc

/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:73748
                throw e;
                ^

Error: Debug Failure. Unexpected node.
Node 156 was unexpected.
    at getDeclarationSpaces (/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:46074:41)
    at /Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:46066:84
    at Object.forEach (/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:217:30)
    at getDeclarationSpaces (/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:46066:28)
    at checkExportsOnMergedDeclarations (/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:46009:41)
    at checkVariableLikeDeclaration (/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:47011:17)
    at checkVariableDeclaration (/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:47048:20)
    at checkSourceElementWorker (/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:48787:28)
    at checkSourceElement (/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:48648:17)
    at Object.forEach (/Users/oliverjash/Development/typescript-playground/node_modules/typescript/lib/tsc.js:217:30)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
fatcerberuscommented, Jul 3, 2019

Error: Debug Failure. Unexpected node

🐞 That’s not a normal error message. The compiler actually crashed. It’s 100% a bug. 😄

0reactions
captain-yossariancommented, Jan 17, 2020

@sandersn I think I’ve figured out why this error happens, at least in my code. My code:

/**
 * @typedef (Object) CustomProps
 * @property (Boolean) visible
 * @property (children:React.ReactNode) children
 *
 * @param {CustomProps} props
 */
const SomeComponent=(props)=><div>Hello</div>;

As you see, there is invalid JSDoc syntax. TS compiler crashed here typescript\lib\typescript.js:59394.

// d.kind = 75, SyntaxKind.Identifier
return ts.Debug.failBadSyntaxKind(d)

After JSDoc code was fixed, the error is gone. I hope it will help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Fix the “409 Conflict” Error (5 Methods) - Kinsta
The "409 conflict" error can be frustrating, but it is actually easy to fix. Learn how to fix the error using 5 different...
Read more >
409 Conflict - HTTP - MDN Web Docs
The HTTP 409 Conflict response status code indicates a request conflict with the current state of the target resource.
Read more >
TPT04106 Error: Conflicting job names have been specified ...
TPT04106 Error: Conflicting job names have been specified for 'tbuild' command argument : '%s' and '%s'. Explanation: A TPT job can have ...
Read more >
Fix conflicting records errors - Google Domains Help
When created records conflict with existing records, or a browser extension misreads fields, you may see error messages. The following are examples of...
Read more >
Design-time errors in the Windows Forms Designer
This is an error in the component you just loaded or placed on the form. It indicates that the component did not add...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found