_From @asvetliakov on June 12, 2017 16:40_
May be related to #28112
I'm not sure how to reproduce it yet. It seems to happen randomly and VERY often.
Steps:
Typescript version: 2.3.3, also i didn't have any issues with vscode 1.12.0
I'm getting this in typescript service output:
[Error - 6:32:24 PM] 'navtree' request failed with error.
Error processing request. Cannot read property 'charCount' of undefined
TypeError: Cannot read property 'charCount' of undefined
at LineNode.walk (/Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:78490:47)
at LineIndex.edit (/Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:78358:35)
at ScriptVersionCache.getSnapshot (/Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:78150:47)
at TextStorage.getSnapshot (/Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:73269:32)
at ScriptInfo.getSnapshot (/Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:73378:41)
at LSHost.getScriptSnapshot (/Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:73648:39)
at SyntaxTreeCache.getCurrentSourceFile (/Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:71449:44)
at Object.getNavigationTree (/Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:71953:71)
at IOSession.Session.getNavigationTree (/Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:77613:62)
at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:76670:61)
Full log: https://pastebin.com/X6xpSR1z
Thanks
_Copied from original issue: Microsoft/vscode#28543_
Looks like the first failure is:
[Error - 6:10:16 PM] 'signatureHelp' request failed with error.
Error processing request. Debug Failure. False expression:
Error: Debug Failure. False expression:
at Object.assert (/Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:2902:23)
at Object.computePositionOfLineAndCharacter (/Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:9137:18)
at TextStorage.lineOffsetToPosition (/Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:73296:31)
at ScriptInfo.lineOffsetToPosition (/Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:73508:41)
at IOSession.Session.getPosition (/Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:77280:81)
at IOSession.Session.getSignatureHelpItems (/Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:77501:37)
at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (/Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:76599:61)
at /Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:77820:88
at IOSession.Session.executeWithRequestId (/Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:77811:28)
at IOSession.Session.executeCommand (/Users/asvetl/work/applications/frontend/node_modules/typescript/lib/tsserver.js:77820:33)
(The cancelled requests ones are from vscode and not really errors. I've fixed the logging of these in the current vscode insiders builds)
Hi @asvetliakov, what we can tell from the log is that the server is somehow getting into a bad state where the contents of a source file are out-of-sync with line/column information. But we don't know how it got into that state. The attatched log doesn't seem to begin from the launch of the tsserver; that would be indicated if it started like:
Info 0 Binding...
Info 1 request: {"seq":0,"type":"request","command":"configure","arguments":{"hostInfo":"vscode"}}
Info 2 Host information vscode
Info 3 response: {"seq":0,"type":"response","command":"configure","request_seq":0,"success":true}
Perf 4 0::configure: async elapsed time (in milliseconds) 1.3250
Would you be able to get a complete log from the start?
If you don't want it pasted to github, you could also email me at [email protected].
@andy-ms Just sent full trace log to your email
Hi @asvetliakov, that looks like a different log file that what we were expecting.
In VSCode you should be able to open the command palette and choose "TypeScript: Open TS Server Log". This should take you to a directory with a file tsserver.log inside. That should start with the header I mentioned above.
@asvetliakov Thanks, that looks like the correct one.
I'm having this issue too, do you need additional logs?
Thanks, we've already reproduced the error.
@asvetliakov We noticed the following on line 17 of the log you sent us:
Info 16 Add recursive watcher for: /Users/.../projectName
Info 17 Add recursive watcher for: /users/.../projectName/src
Could you check that your file system is case-sensitive? I've adapted the code we use to test for this, so you can put it in any .js file and run:
const os = require("os");
const fs = require("fs");
function fileExists(path) {
try {
const stat = fs.statSync(path);
return stat.isFile();
}
catch (e) {
return false;
}
}
function isFileSystemCaseSensitive() {
const platform = os.platform();
// win32\win64 are case insensitive platforms
if (platform === "win32" || platform === "win64") {
return false;
}
// convert current file name to upper case / lower case and check if file exists
// (guards against cases when name is already all uppercase or lowercase)
return !fileExists(__filename.toUpperCase()) || !fileExists(__filename.toLowerCase());
}
console.log(isFileSystemCaseSensitive());
@Pajn Could you check for something similar, or send us your logs too?
No, my file system is case-insensitive. Your code gives false output.
Also noticed that this problem always happened after i'd created some new file in project and started to edit it. Happens even in small projects.
@asvetliakov Could you share your tsconfig.json? Also, logs from a small project would be helpful, especially if you could share steps to create the project. Just in case we need it, what is your OS?
@andy-ms
My OS is macOS 12.5 and tsconfig is:
{
"compilerOptions": {
"strict": true,
"strictNullChecks": true,
"target": "es2016",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"noEmitOnError": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"types": [
"node",
"jest"
],
"noUnusedLocals": true,
"outDir": "./compiled",
"typeRoots": [
"types",
"node_modules/@types"
],
"baseUrl": ".",
"paths": {
"*": [
"types/*"
]
}
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules",
"compiled"
]
}
Also, looks like i can't reproduce it now with the new version of vscode 1.14, so may be error came from vscode side, as i didn't have any problems with version 1.12 too. Should i try to capture logs from vscode 1.13?
Hi @asvetliakov , I think at this point the specific error we are looking for is when both a /Users and /users directory show up in the logs -- since there should only be /Users (assuming upper-case is the correct name). In the logs we have it looks like that showed up immediately, so it should be easy to tell whether this is still happening. I assume that if you ls /users/.../projectName/src you get an error because no such directory exists?
Also of note, our watcher for "/users" does somehow seem to be getting fired, which is how we end up with duplicate files.
The only file that is giving us problems is named Cookie.ts. The C is always upper-case, but in the log it alternates between /Users/.../Cookie.ts and /users/.../Cookie.ts.
Every other file seems to use an uppercase /Users.
We also seem to be getting vscode some "open" events for lower-case "users", although only after we send it a "configFileDiag" event. (Since apparently we consider the tsconfig for /users/.../Cookie.ts to be different than the one for /Users/.../Cookie.ts, even though the tsconfigs both have the same /Users/.../tsconfig.json path.)
@sheetalkamat Is also refactoring our watch implementation so she might have insight into how we ended up watching a lower-case directory.
Based on discussion with @sheetalkamat this may be solved by the new watch implementation.
(Ref: #17269)
Still have multiple /users in logs for vscode 1.14
Info 16 Add recursive watcher for: /Users/asvetl/work/applications/frontend
Info 17 Add recursive watcher for: /users/asvetl/work/applications/frontend/src
Info 18 Add type root watcher for: /Users/asvetl/work/applications/frontend/types
Info 19 Add type root watcher for: /Users/asvetl/work/applications/frontend/node_modules/@types
I assume that if you ls /users/.../projectName/src you get an error because no such directory exists?
No. Both ls /users/... and ls /Users/... are giving success result (with directory structure)
I'm sorry for not coming back sooner.
The computer where I have seen this error is a mac with a default installation, which means that the file system is case-insensitive. Both ls /users/rasmus and ls /Users/rasmus work fine.
I am not sure if my problem is exactly the same, but after having added some new files in the project, tsc began to crash with :
C:\node-projects\payroll-app\node_modules\schemats\node_modules\tslint\node_modules\typescript\lib\tsc.js:2062
throw e;
^
Error: Debug Failure. False expression.
at computePositionOfLineAndCharacter (C:\node-projects\payroll-app\node_modules\schemats\node_modules\tslint\node_modules\typescript\lib\tsc.js:3752:22)
at Object.getPositionOfLineAndCharacter (C:\node-projects\payroll-app\node_modules\schemats\node_modules\tslint\node_modules\typescript\lib\tsc.js:3742:16)
at Object.formatDiagnosticsWithColorAndContext (C:\node-projects\payroll-app\node_modules\schemats\node_modules\tslint\node_modules\typescript\lib\tsc.js:55564:59)
at reportDiagnosticWithColorAndContext (C:\node-projects\payroll-app\node_modules\schemats\node_modules\tslint\node_modules\typescript\lib\tsc.js:58760:25)
at reportDiagnostic (C:\node-projects\payroll-app\node_modules\schemats\node_modules\tslint\node_modules\typescript\lib\tsc.js:58722:9)
at reportDiagnostics (C:\node-projects\payroll-app\node_modules\schemats\node_modules\tslint\node_modules\typescript\lib\tsc.js:58727:13)
at compileProgram (C:\node-projects\payroll-app\node_modules\schemats\node_modules\tslint\node_modules\typescript\lib\tsc.js:59088:13)
at compile (C:\node-projects\payroll-app\node_modules\schemats\node_modules\tslint\node_modules\typescript\lib\tsc.js:59040:26)
at performCompilation (C:\node-projects\payroll-app\node_modules\schemats\node_modules\tslint\node_modules\typescript\lib\tsc.js:58929:33)
at Object.executeCommandLine (C:\node-projects\payroll-app\node_modules\schemats\node_modules\tslint\node_modules\typescript\lib\tsc.js:58872:9)
at Object.<anonymous> (C:\node-projects\payroll-app\node_modules\schemats\node_modules\tslint\node_modules\typescript\lib\tsc.js:59230:4)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\node-projects\payroll-app\node_modules\schemats\node_modules\tslint\node_modules\typescript\bin\tsc:2:1)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Function.Module.runMain (module.js:609:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:598:3
Tsc : 2.5.1 and 2.6.0-dev.20170829
Windows 10 64 bits
Nodejs 8.4.0
I can provide ts server log if need be.
Can you please give a try to typescript@next to see if this works. I believe this with merge of PR #17669
I haven't seen the issue any more after upgrading to 2.5.2
For posterity, I'm still seeing the "Debug Failure. False expression. at computePositionOfLineAndCharacter" error with 2.5.3 on OSX Sierra, but the problem is fixed in typescript@next so I'm not opening a new issue.
Most helpful comment
I haven't seen the issue any more after upgrading to 2.5.2