microsoft/TypeScript

Debug failure in `computePositionOfLineAndCharacter` when decoding source map

andy-ms opened this issue · 2 comments

TypeScript Version: master

Code

    Debug Failure. False expression.

    Error: Debug Failure. False expression.
    at computePositionOfLineAndCharacter (/home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:5951:22)
    at Object.getPositionOfLineAndCharacter (/home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:5941:16)
    at getPositionOfLineAndCharacterUsingName (/home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:61580:27)
    at processPosition (/home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:61602:37)
    at Object.arrayFrom (/home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:1129:31)
    at calculateDecodedMappings (/home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:61647:32)
    at getDecodedMappings (/home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:61583:62)
    at getGeneratedOrderedMappings (/home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:61589:80)
    at Object.getOriginalPosition (/home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:61555:28)
    at Object.tryGetOriginalLocation (/home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:99306:63)
    at getMappedLocation (/home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:117884:52)
    at /home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:118484:34
    at Array.map (native)
    at IOSession.Session.mapDefinitionInfoLocations (/home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:118483:36)
    at IOSession.Session.getDefinitionAndBoundSpan (/home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:118511:40)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:117943:61)
    at /home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:119442:88
    at IOSession.Session.executeWithRequestId (/home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:119433:28)
    at IOSession.Session.executeCommand (/home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:119442:33)
    at IOSession.Session.onMessage (/home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:119462:35)
    at Interface.<anonymous> (/home/andy/.nvm/versions/node/v10.5.0/lib/node_modules/typescript/lib/tsserver.js:120735:27)
    at emitOne (events.js:96:13)
    at Interface.emit (events.js:191:7)
    at Interface._onLine (readline.js:241:10)
    at Interface._normalWrite (readline.js:384:12)
    at Socket.ondata (readline.js:101:10)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at readableAddChunk (_stream_readable.js:178:18)
    at Socket.Readable.push (_stream_readable.js:136:10)
    at Pipe.onread (net.js:560:20)

I get this error when the build is slightly out-of-date. May not be possible to get a right answer here, but we should give up instead of crashing.

#28109 has a repro in more detail.

Repro from @rbuckton:

Repro steps:

  1. From a shell:
  2. git clone https://github.com/rbuckton/ts-rename-repro
  3. cd ts-rename-repro
  4. npm install - installs lerna
  5. npm run bootstrap - runs lerna bootstrap --hoist
  6. code .
  7. From VS Code:
  8. Open packages/b/src/index.ts
  9. Position the cursor on Foo and execute either the Rename Symbol or Go to Definition command.

Expected behavior:

You should be able to rename the symbol or go to definition.

Actual behavior:

  • For Rename: "An unknown error occurred while resolving rename location"
[Error  - 12:45:07 PM] 'rename' request failed with error.
Error processing request. Debug Failure. False expression.
Error: Debug Failure. False expression.
    at computePositionOfLineAndCharacter (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:6377:22)
    at Object.getPositionOfLineAndCharacter (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:6367:16)
    at getPositionOfLineAndCharacterUsingName (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:63341:27)
    at processPosition (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:63363:37)
    at Object.arrayFrom (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:1136:31)
    at calculateDecodedMappings (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:63408:32)
    at getDecodedMappings (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:63344:62)
    at getGeneratedOrderedMappings (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:63350:80)
    at Object.getOriginalPosition (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:63315:28)
    at Object.tryGetOriginalLocation (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:101746:63)
    at ProjectService.getOriginalLocationEnsuringConfiguredProject (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:120744:66)
    at c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:121490:55
    at c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:121405:82
    at callbackProjectAndLocation (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:121488:13)
    at c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:121462:24
    at forEachProjectInProjects (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:121446:17)
    at combineProjectOutputWorker (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:121460:13)
    at combineProjectOutputForRenameLocations (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:121401:13)
    at IOSession.Session.getRenameLocations (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:122367:33)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:121604:61)
    at c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:123086:88
    at IOSession.Session.executeWithRequestId (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:123077:28)
    at IOSession.Session.executeCommand (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:123086:33)
    at IOSession.Session.onMessage (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:123106:35)
    at Interface.<anonymous> (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:124369:27)
    at emitOne (events.js:116:13)
    at Interface.emit (events.js:211:7)
    at Interface._onLine (readline.js:282:10)
    at Interface._normalWrite (readline.js:424:12)
    at Socket.ondata (readline.js:141:10)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at Pipe.onread (net.js:594:20)
  • For Go to Definition: "No definition found for 'Foo'"
[Error  - 12:46:03 PM] 'definitionAndBoundSpan' request failed with error.
Error processing request. Debug Failure. False expression.
Error: Debug Failure. False expression.
    at computePositionOfLineAndCharacter (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:6377:22)
    at Object.getPositionOfLineAndCharacter (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:6367:16)
    at getPositionOfLineAndCharacterUsingName (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:63341:27)
    at processPosition (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:63363:37)
    at Object.arrayFrom (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:1136:31)
    at calculateDecodedMappings (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:63408:32)
    at getDecodedMappings (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:63344:62)
    at getGeneratedOrderedMappings (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:63350:80)
    at Object.getOriginalPosition (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:63315:28)
    at Object.tryGetOriginalLocation (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:101746:63)
    at getMappedLocation (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:121521:52)
    at c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:122129:34
    at Array.map (<anonymous>)
    at IOSession.Session.mapDefinitionInfoLocations (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:122128:36)
    at IOSession.Session.getDefinitionAndBoundSpan (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:122156:40)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:121580:61)
    at c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:123086:88
    at IOSession.Session.executeWithRequestId (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:123077:28)
    at IOSession.Session.executeCommand (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:123086:33)
    at IOSession.Session.onMessage (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:123106:35)
    at Interface.<anonymous> (c:\Users\rbuckton\AppData\Local\Programs\Microsoft VS Code Insiders\resources\app\extensions\node_modules\typescript\lib\tsserver.js:124369:27)
    at emitOne (events.js:116:13)
    at Interface.emit (events.js:211:7)
    at Interface._onLine (readline.js:282:10)
    at Interface._normalWrite (readline.js:424:12)
    at Socket.ondata (readline.js:141:10)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at Pipe.onread (net.js:594:20)

This only occurs when the declaration map (packages/a/dist/index.d.ts.map) is out of date with respect to the source file (packages/a/src/index.ts).