Skip to content

Internal typescript error with no useful information #8961

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
anstosa opened this issue Jun 3, 2016 · 12 comments
Closed

Internal typescript error with no useful information #8961

anstosa opened this issue Jun 3, 2016 · 12 comments
Labels
Needs More Info The issue still hasn't been fully clarified

Comments

@anstosa
Copy link

anstosa commented Jun 3, 2016

I'm trying to compile an existing codebase and getting an error message with no useful context at all and which doesn't reference any of my code. Any pointers here?

Using tsc v1.8.10
/usr/lib64/extrahop_node_modules/node_modules/typescript/lib/tsc.js:33078
                throw e;
                      ^
TypeError: Cannot read property 'id' of undefined
    at getNodeId (/usr/lib64/extrahop_node_modules/node_modules/typescript/lib/tsc.js:11646:18)
    at getNodeLinks (/usr/lib64/extrahop_node_modules/node_modules/typescript/lib/tsc.js:12007:26)
    at checkExpressionCached (/usr/lib64/extrahop_node_modules/node_modules/typescript/lib/tsc.js:20308:25)
    at /usr/lib64/extrahop_node_modules/node_modules/typescript/lib/tsc.js:13842:107
    at Object.map (/usr/lib64/extrahop_node_modules/node_modules/typescript/lib/tsc.js:163:29)
    at getTypeOfVariableOrParameterOrProperty (/usr/lib64/extrahop_node_modules/node_modules/typescript/lib/tsc.js:13842:57)
    at getTypeOfSymbol (/usr/lib64/extrahop_node_modules/node_modules/typescript/lib/tsc.js:13958:24)
    at writeLiteralType (/usr/lib64/extrahop_node_modules/node_modules/typescript/lib/tsc.js:13281:33)
    at writeAnonymousType (/usr/lib64/extrahop_node_modules/node_modules/typescript/lib/tsc.js:13176:25)
    at writeType (/usr/lib64/extrahop_node_modules/node_modules/typescript/lib/tsc.js:13064:25)
@vladima
Copy link
Contributor

vladima commented Jun 3, 2016

can you share the repro scenario for this issue?

@anstosa
Copy link
Author

anstosa commented Jun 3, 2016

Unfortunately, no. I can't narrow down what's causing this in a repo of several hundred files. I'm hoping someone has tips on what might be causing this or troubleshooting steps so I don't have to just poke blindly... every similar error I saw while researching this error referenced the user's code above the stack trace... it seems like this is being thrown by TS from TS.

@mhegazy
Copy link
Contributor

mhegazy commented Jun 3, 2016

can you try using node-inspector to debug the tsc.js process:

npm install -g node-inspector
node-inspector

node --debug-brk <path to your tsc.js>

somewhere on the stack, there should be a call to getDiagnosticsWorker. the argument sourceFile.fileName will tell you which file is causing the issue. hopefully this helps to narrow down the repro.

@mhegazy mhegazy added the Needs More Info The issue still hasn't been fully clarified label Jun 3, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Jun 4, 2016

also a longer stack trace would be helpful. for that try:

node --stack-trace-limit=1000 tsc.js ...

@anstosa
Copy link
Author

anstosa commented Jun 6, 2016

Thanks @mhegazy! I was never able to get an isolated repro for this but I did narrow it down to 3 problem files and it seemed to be related to binding functions in the constructor? this.foo = this.foo.bind(this);.

Removed those and now it all compiles. ¯_(ツ)_/¯

@anstosa anstosa closed this as completed Jun 6, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Jun 6, 2016

was this a .js or a .ts file? we would love to figure out the issue and fix so you do not have to change your code.

@anstosa
Copy link
Author

anstosa commented Jun 6, 2016

It was a .js file with --allowJs. I was compiling via grunt-ts.

@mhegazy
Copy link
Contributor

mhegazy commented Jun 6, 2016

is there any chance you can share a sample? we would be happy to sign any NDA to get access to the code.

@anstosa
Copy link
Author

anstosa commented Jun 6, 2016

Let me check with my manager. I'll also try to revisit this by the end of the week and try to figure out what actually happened. I'm in a bit of a rush right now because I'm blocking people.

@DataTables
Copy link

I'm encountering this error at the moment as well (found this issue via Google). It sounds a lot like this issue which was fixed in 2.0.2 (although 2.0.0 hasn't been released yet which I've got to admit I'm totally confused about :-) ).

@DataTables
Copy link

Yup - installed 2.0.2 via npm and it made this error "go away" for me. Assuming that it is the same error (it sure sounds like it) I think this is resolved.

@tibbus
Copy link

tibbus commented Jul 28, 2017

This happened to me as well, there is no details to error just Error: length < 0 node_modules\typescript\lib\tsc.js:53737 throw e;

In my case it was because I left git conflict unresolved with <<<<<<<<<< code
Related to : #12952

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs More Info The issue still hasn't been fully clarified
Projects
None yet
Development

No branches or pull requests

4 participants