Skip to content
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

Error: Debug Failure. False expression. in 'Object.createRange' during 'getEditsForFileRename' #37685

Closed
typescript-bot opened this issue Mar 30, 2020 · 10 comments
Labels
Bug A bug in TypeScript Source: Telemetry The issue relates to the telemetry in editors
Milestone

Comments

@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 30, 2020

This issue comes from crash dumps in telemetry. We've tried to de-duplicate issues on a best-effort basis, comparing the sequence of methods called and the command requested while ignoring line numbers.
TypeScript version prefix: 3.8.3
VSCode version: 1.43.2
Command requested: getEditsForFileRename
Hitting sessions: 2180
Five line hash: 26ad18b87d095b701e17d7b789e1cce5
Stack:

    at createRange (tsserver.js:16758:18)
    at createStringRange (tsserver.js:115337:19)
    at updateImportsWorker (tsserver.js:115333:64)
    at _loop_4 (tsserver.js:115243:13)
    at updateImports (tsserver.js:115267:13)
    at <anonymous> (tsserver.js:115136:13)
    at ChangeTracker.with (tsserver.js:123413:17)
    at getEditsForFileRename (tsserver.js:115134:49)
    at getEditsForFileRename (tsserver.js:135687:23)
    at <anonymous> (tsserver.js:145745:146)
    at <anonymous> (tsserver.js:144008:36)
    at <anonymous> (tsserver.js:141432:25)
    at ProjectService.forEachProject (tsserver.js:141425:41)
    at ProjectService.forEachEnabledProject (tsserver.js:141430:22)
    at combineProjectOutputFromEveryProject (tsserver.js:144007:28)
    at Session.getEditsForFileRename (tsserver.js:145745:31)
    at _a.<computed> (tsserver.js:144543:61)
    at <anonymous> (tsserver.js:146003:88)
    at Session.executeWithRequestId (tsserver.js:145994:28)
    at Session.executeCommand (tsserver.js:146003:33)
    at Session.onMessage (tsserver.js:146027:35)
    at <anonymous> (tsserver.js:147342:27)
    at unknown (suppressed.js)
    at unknown (suppressed.js)
    at unknown (suppressed.js)
    at unknown (suppressed.js)
    at unknown (suppressed.js)
    at unknown (suppressed.js)
    at unknown (suppressed.js)
    at unknown (suppressed.js)
    at unknown (suppressed.js)
@typescript-bot typescript-bot added Bug A bug in TypeScript Source: Telemetry The issue relates to the telemetry in editors labels Mar 30, 2020
@typescript-bot
Copy link
Collaborator Author

Revised stack format and updated hash.

@typescript-bot
Copy link
Collaborator Author

This issue reproduced in the following context:
TypeScript version prefix: 3.9.6
VSCode version: 1.47.0
Command requested: getEditsForFileRename
Hitting sessions: 4870
Five line hash: 26ad18b87d095b701e17d7b789e1cce5
Stack:

    at createRange (tsserver.js:17194:18)
    at createStringRange (tsserver.js:118051:19)
    at updateImportsWorker (tsserver.js:118047:64)
    at _loop_4 (tsserver.js:117957:13)
    at updateImports (tsserver.js:117981:13)
    at <anonymous> (tsserver.js:117850:13)
    at ChangeTracker.with (tsserver.js:126221:17)
    at getEditsForFileRename (tsserver.js:117848:49)
    at getEditsForFileRename (tsserver.js:139225:23)
    at <anonymous> (tsserver.js:149295:146)
    at <anonymous> (tsserver.js:147534:36)
    at <anonymous> (tsserver.js:144903:25)
    at ProjectService.forEachProject (tsserver.js:144896:41)
    at ProjectService.forEachEnabledProject (tsserver.js:144901:22)
    at combineProjectOutputFromEveryProject (tsserver.js:147533:28)
    at Session.getEditsForFileRename (tsserver.js:149295:31)
    at _a.<computed> (tsserver.js:148073:61)
    at <anonymous> (tsserver.js:149553:88)
    at Session.executeWithRequestId (tsserver.js:149544:28)
    at Session.executeCommand (tsserver.js:149553:33)
    at Session.onMessage (tsserver.js:149577:35)
    at <anonymous> (tsserver.js:150893:27)
    at unknown (suppressed.js:203:13)
    at unknown (suppressed.js:316:10)
    at unknown (suppressed.js:461:12)
    at unknown (suppressed.js:172:10)
    at unknown (suppressed.js:203:13)
    at unknown (suppressed.js:295:12)
    at unknown (suppressed.js:276:11)
    at unknown (suppressed.js:210:10)
    at unknown (suppressed.js:166:17)

@typescript-bot
Copy link
Collaborator Author

This issue reproduced in the following context:
TypeScript version prefix: 3.9.7
VSCode version: 1.47.2
Command requested: getEditsForFileRename
Hitting sessions: 138
Five line hash: 26ad18b87d095b701e17d7b789e1cce5
Stack:

    at createRange (tsserver.js:17196:18)
    at createStringRange (tsserver.js:118053:19)
    at updateImportsWorker (tsserver.js:118049:64)
    at _loop_4 (tsserver.js:117959:13)
    at updateImports (tsserver.js:117983:13)
    at <anonymous> (tsserver.js:117852:13)
    at ChangeTracker.with (tsserver.js:126223:17)
    at getEditsForFileRename (tsserver.js:117850:49)
    at getEditsForFileRename (tsserver.js:139227:23)
    at <anonymous> (tsserver.js:149297:146)
    at <anonymous> (tsserver.js:147536:36)
    at <anonymous> (tsserver.js:144905:25)
    at ProjectService.forEachProject (tsserver.js:144898:41)
    at ProjectService.forEachEnabledProject (tsserver.js:144903:22)
    at combineProjectOutputFromEveryProject (tsserver.js:147535:28)
    at Session.getEditsForFileRename (tsserver.js:149297:31)
    at _a.<computed> (tsserver.js:148075:61)
    at <anonymous> (tsserver.js:149555:88)
    at Session.executeWithRequestId (tsserver.js:149546:28)
    at Session.executeCommand (tsserver.js:149555:33)
    at Session.onMessage (tsserver.js:149579:35)
    at <anonymous> (tsserver.js:150895:27)
    at unknown (suppressed.js:203:13)
    at unknown (suppressed.js:316:10)
    at unknown (suppressed.js:461:12)
    at unknown (suppressed.js:172:10)
    at unknown (suppressed.js:203:13)
    at unknown (suppressed.js:295:12)
    at unknown (suppressed.js:276:11)
    at unknown (suppressed.js:210:10)
    at unknown (suppressed.js:166:17)

@typescript-bot
Copy link
Collaborator Author

This issue reproduced in the following context:
TypeScript version prefix: 4.0.2
VSCode version: 1.49.0-insider
Command requested: getEditsForFileRename
Hitting sessions: 106
Five line hash: 26ad18b87d095b701e17d7b789e1cce5
Stack:

    at createRange (tsserver.js:17175:18)
    at createStringRange (tsserver.js:121076:19)
    at updateImportsWorker (tsserver.js:121072:64)
    at _loop_4 (tsserver.js:120982:13)
    at updateImports (tsserver.js:121006:13)
    at <anonymous> (tsserver.js:120875:13)
    at ChangeTracker.with (tsserver.js:129418:17)
    at getEditsForFileRename (tsserver.js:120873:49)
    at getEditsForFileRename (tsserver.js:143809:23)
    at <anonymous> (tsserver.js:154646:173)
    at <anonymous> (tsserver.js:152760:36)
    at <anonymous> (tsserver.js:150006:25)
    at ProjectService.forEachProject (tsserver.js:149999:41)
    at ProjectService.forEachEnabledProject (tsserver.js:150004:22)
    at combineProjectOutputFromEveryProject (tsserver.js:152759:28)
    at Session.getEditsForFileRename (tsserver.js:154646:58)
    at _a.<computed> (tsserver.js:153364:61)
    at <anonymous> (tsserver.js:154953:88)
    at Session.executeWithRequestId (tsserver.js:154944:28)
    at Session.executeCommand (tsserver.js:154953:33)
    at Session.onMessage (tsserver.js:154977:35)
    at <anonymous> (tsserver.js:157193:27)
    at unknown (suppressed.js:223:5)
    at unknown (suppressed.js:315:10)
    at unknown (suppressed.js:460:12)
    at unknown (suppressed.js:172:10)
    at unknown (suppressed.js:223:5)
    at unknown (suppressed.js:309:12)
    at unknown (suppressed.js:290:11)
    at unknown (suppressed.js:224:10)
    at unknown (suppressed.js:181:23)

@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Sep 11, 2020
@typescript-bot
Copy link
Collaborator Author

This issue reproduced in the following context:
TypeScript version prefix: 4.0.3
VSCode version: 1.49.0
Command requested: getEditsForFileRename
Hitting sessions: 172
Five line hash: 26ad18b87d095b701e17d7b789e1cce5
Stack:

    at createRange (tsserver.js:17182:18)
    at createStringRange (tsserver.js:121083:19)
    at updateImportsWorker (tsserver.js:121079:64)
    at _loop_4 (tsserver.js:120989:13)
    at updateImports (tsserver.js:121013:13)
    at <anonymous> (tsserver.js:120882:13)
    at ChangeTracker.with (tsserver.js:129425:17)
    at getEditsForFileRename (tsserver.js:120880:49)
    at getEditsForFileRename (tsserver.js:143817:23)
    at <anonymous> (tsserver.js:154654:173)
    at <anonymous> (tsserver.js:152768:36)
    at <anonymous> (tsserver.js:150014:25)
    at ProjectService.forEachProject (tsserver.js:150007:41)
    at ProjectService.forEachEnabledProject (tsserver.js:150012:22)
    at combineProjectOutputFromEveryProject (tsserver.js:152767:28)
    at Session.getEditsForFileRename (tsserver.js:154654:58)
    at _a.<computed> (tsserver.js:153372:61)
    at <anonymous> (tsserver.js:154962:88)
    at Session.executeWithRequestId (tsserver.js:154953:28)
    at Session.executeCommand (tsserver.js:154962:33)
    at Session.onMessage (tsserver.js:154986:35)
    at <anonymous> (tsserver.js:157202:27)
    at unknown (suppressed.js:223:5)
    at unknown (suppressed.js:315:10)
    at unknown (suppressed.js:460:12)
    at unknown (suppressed.js:172:10)
    at unknown (suppressed.js:223:5)
    at unknown (suppressed.js:309:12)
    at unknown (suppressed.js:290:11)
    at unknown (suppressed.js:224:10)
    at unknown (suppressed.js:181:23)

@OliverJAsh
Copy link
Contributor

I am running into this issue when trying to rename a folder. (Renaming files seems to work.)

Do you already have a reduced test case or do you need one? I am struggling to reduce it down but I can provide access to our project.

Info 1725 [12:17:56.433] request:
    {"seq":31,"type":"request","command":"getEditsForFileRename","arguments":{"oldFilePath":"/Users/oliverash/Development/unsplash-web/app/components/Test","newFilePath":"/Users/oliverash/Development/unsplash-web/app/components/Test2"}}
Err 1726  [12:17:56.563] Exception on executing command {"seq":31,"type":"request","command":"getEditsForFileRename","arguments":{"oldFilePath":"/Users/oliverash/Development/unsplash-web/app/components/Test","newFilePath":"/Users/oliverash/Development/unsplash-web/app/components/Test2"}}:

    Debug Failure. False expression.

    Error: Debug Failure. False expression.
        at Object.createRange (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:17182:18)
        at createStringRange (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:121138:19)
        at updateImportsWorker (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:121134:64)
        at _loop_4 (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:121044:13)
        at updateImports (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:121068:13)
        at /Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:120937:13
        at Function.ChangeTracker.with (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:129480:17)
        at Object.getEditsForFileRename (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:120935:49)
        at Proxy.getEditsForFileRename (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:143872:23)
        at /Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:154709:173
        at /Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:152823:36
        at /Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:150069:25
        at Map.forEach (<anonymous>)
        at ProjectService.forEachProject (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:150062:41)
        at ProjectService.forEachEnabledProject (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:150067:22)
        at combineProjectOutputFromEveryProject (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:152822:28)
        at IOSession.Session.getEditsForFileRename (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:154709:58)
        at Session.handlers.ts.Map.ts.getEntries._a.<computed> (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:153427:61)
        at /Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:155017:88
        at IOSession.Session.executeWithRequestId (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:155008:28)
        at IOSession.Session.executeCommand (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:155017:33)
        at IOSession.Session.onMessage (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:155041:35)
        at Interface.<anonymous> (/Users/oliverash/Development/unsplash-web/node_modules/typescript/lib/tsserver.js:157257: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)

@OliverJAsh
Copy link
Contributor

I added some logging to see what arguments we're passing in to createStringRange:

             if (updated !== undefined && updated !== importStringLiteral.text)
-                changeTracker.replaceRangeWithText(sourceFile, createStringRange(importStringLiteral, sourceFile), updated);
+                {
+                    console.log(JSON.stringify({ text: importStringLiteral.text, updated }), null, '\t')
+                    changeTracker.replaceRangeWithText(sourceFile, createStringRange(importStringLiteral, sourceFile), updated);
+                }

This logged:

Info 1735 [12:33:14.901] {"text":"tslib","updated":"components/Test2/node_modules/tslib"}, , 	

This made me wonder whether the bug is something to do with having importHelpers enabled. When I disabled it, everything worked!

@typescript-bot
Copy link
Collaborator Author

This issue reproduced in the following context:
TypeScript version prefix: 4.0.5
VSCode version: 1.51.1
Command requested: getEditsForFileRename
Hitting sessions: 109
Five line hash: 26ad18b87d095b701e17d7b789e1cce5
Stack:

    at createRange (tsserver.js:17182:18)
    at createStringRange (tsserver.js:121138:19)
    at updateImportsWorker (tsserver.js:121134:64)
    at _loop_4 (tsserver.js:121044:13)
    at updateImports (tsserver.js:121068:13)
    at <anonymous> (tsserver.js:120937:13)
    at ChangeTracker.with (tsserver.js:129480:17)
    at getEditsForFileRename (tsserver.js:120935:49)
    at getEditsForFileRename (tsserver.js:143872:23)
    at <anonymous> (tsserver.js:154709:173)
    at <anonymous> (tsserver.js:152823:36)
    at <anonymous> (tsserver.js:150069:25)
    at ProjectService.forEachProject (tsserver.js:150062:41)
    at ProjectService.forEachEnabledProject (tsserver.js:150067:22)
    at combineProjectOutputFromEveryProject (tsserver.js:152822:28)
    at Session.getEditsForFileRename (tsserver.js:154709:58)
    at _a.<computed> (tsserver.js:153427:61)
    at <anonymous> (tsserver.js:155017:88)
    at Session.executeWithRequestId (tsserver.js:155008:28)
    at Session.executeCommand (tsserver.js:155017:33)
    at Session.onMessage (tsserver.js:155041:35)
    at <anonymous> (tsserver.js:157257:27)
    at unknown (suppressed.js:223:5)
    at unknown (suppressed.js:315:10)
    at unknown (suppressed.js:460:12)
    at unknown (suppressed.js:172:10)
    at unknown (suppressed.js:223:5)
    at unknown (suppressed.js:309:12)
    at unknown (suppressed.js:290:11)
    at unknown (suppressed.js:224:10)
    at unknown (suppressed.js:181:23)

@DanielRosenwasser
Copy link
Member

@OliverJAsh do you still see this error in newer versions?

@OliverJAsh
Copy link
Contributor

All good now I think! Do you know what fixed it?

Btw, it would be nice if compiler errors like the one above were more apparent. It took me awhile to figure out what was going on here because it was just failing silently.

If there's a fatal error, I want to be notified so I can file an issue. I suggested this here but it was turned down 😒 microsoft/vscode#113559

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Source: Telemetry The issue relates to the telemetry in editors
Projects
None yet
Development

No branches or pull requests

4 participants