TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

I triggered the Debug assertion `Revert #54442 and add a testcase with whatever triggered this` when running with `--diagnostics`

Open littlebutt opened this issue 10 months ago • 3 comments

🔎 Search Terms

"54442", "diagnostics"

🕗 Version & Regression Information

  • This changed between versions before and 5.8.2
  • This changed in commit or PR e79b644
  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about issue #54442
  • I was unable to test this on prior versions because it is related to a previous issue.

⏯ Playground Link

No response

💻 Code

# Almost do nothing but run this command on tests/cases/compiler
tsc --diagnostics

🙁 Actual behavior

It shows

Error: Debug Failure. False expression: Revert #54442 and add a testcase with whatever triggered this

🙂 Expected behavior

compiling the project correctly

Additional information about the issue

It seems it's related to the previous issue #54442

littlebutt avatar Mar 17 '25 13:03 littlebutt

# Almost do nothing but run this command on tests/cases/compiler
tsc --diagnostics

I'm not seeing this. Can you narrow it down a bit?

RyanCavanaugh avatar Mar 17 '25 19:03 RyanCavanaugh

The tsconfig.json is as followed

{
  "compilerOptions": {
    "target": "es2016",                            
    "module": "commonjs", 
    "outDir": "./tmp", 
    "esModuleInterop": true, 
    "forceConsistentCasingInFileNames": true, 
    "strict": true, 
    "skipLibCheck": true
  }
}

After running tsc --diagnostics or jsut tsc, it shows:

C:\Users\Administrator\AppData\Roaming\npm\node_modules\typescript\lib\_tsc.js:122135
      throw e;
      ^

Error: Debug Failure. False expression: Revert #54442 and add a testcase with whatever triggered this
    at resolveCall (C:\Users\Administrator\AppData\Roaming\npm\node_modules\typescript\lib\_tsc.js:75516:13)
    at resolveCallExpression (C:\Users\Administrator\AppData\Roaming\npm\node_modules\typescript\lib\_tsc.js:75908:18)
    at resolveSignature (C:\Users\Administrator\AppData\Roaming\npm\node_modules\typescript\lib\_tsc.js:76398:16)
    at getResolvedSignature (C:\Users\Administrator\AppData\Roaming\npm\node_modules\typescript\lib\_tsc.js:76425:20)
    at checkCallExpression (C:\Users\Administrator\AppData\Roaming\npm\node_modules\typescript\lib\_tsc.js:76533:23)
    at checkExpressionWorker (C:\Users\Administrator\AppData\Roaming\npm\node_modules\typescript\lib\_tsc.js:79950:16)
    at checkExpression (C:\Users\Administrator\AppData\Roaming\npm\node_modules\typescript\lib\_tsc.js:79849:32)
    at checkExpressionStatement (C:\Users\Administrator\AppData\Roaming\npm\node_modules\typescript\lib\_tsc.js:82427:5)
    at checkSourceElementWorker (C:\Users\Administrator\AppData\Roaming\npm\node_modules\typescript\lib\_tsc.js:85492:16)
    at checkSourceElement (C:\Users\Administrator\AppData\Roaming\npm\node_modules\typescript\lib\_tsc.js:85344:7)

Node.js v20.15.0

I hope this can help you.

littlebutt avatar Mar 18 '25 11:03 littlebutt

We need the input code too

RyanCavanaugh avatar Mar 18 '25 15:03 RyanCavanaugh

I've also run into this in 5.8.3, with a nearly identical stack trace:

$ npx tsc -p <path/to>/tsconfig.json
C:\EpicSource\11.5\tsc-bug-repro\node_modules\typescript\lib\_tsc.js:122142
      throw e;
      ^

Error: Debug Failure. False expression: Revert #54442 and add a testcase with whatever triggered this
    at resolveCall (C:\EpicSource\11.5\tsc-bug-repro\node_modules\typescript\lib\_tsc.js:75518:13)
    at resolveCallExpression (C:\EpicSource\11.5\tsc-bug-repro\node_modules\typescript\lib\_tsc.js:75910:18)
    at resolveSignature (C:\EpicSource\11.5\tsc-bug-repro\node_modules\typescript\lib\_tsc.js:76400:16)
    at getResolvedSignature (C:\EpicSource\11.5\tsc-bug-repro\node_modules\typescript\lib\_tsc.js:76427:20)
    at checkCallExpression (C:\EpicSource\11.5\tsc-bug-repro\node_modules\typescript\lib\_tsc.js:76535:23)
    at checkExpressionWorker (C:\EpicSource\11.5\tsc-bug-repro\node_modules\typescript\lib\_tsc.js:79957:16)
    at checkExpression (C:\EpicSource\11.5\tsc-bug-repro\node_modules\typescript\lib\_tsc.js:79856:32)
    at checkExpressionStatement (C:\EpicSource\11.5\tsc-bug-repro\node_modules\typescript\lib\_tsc.js:82434:5)
    at checkSourceElementWorker (C:\EpicSource\11.5\tsc-bug-repro\node_modules\typescript\lib\_tsc.js:85499:16)
    at checkSourceElement (C:\EpicSource\11.5\tsc-bug-repro\node_modules\typescript\lib\_tsc.js:85351:7)

Node.js v23.11.0

$ npx tsc --version
Version 5.8.3

I can try to cut our code down to a minimal test case, but I expect that to take a while -- there are currently 1,638 input files and the tsconfig inherits from a template. Is there a way to get the information you need without trimming things down to something small enough to be shareable?

klylesatepic avatar May 22 '25 18:05 klylesatepic

Never mind -- trimming things down went faster than expected. Here's a reproduction that's as simple as I could make it: Repro.zip. Note that there is a compilation error -- that seems to be part of what's required to hit the assertion.

To reproduce the issue:

  1. Extract the zip file
  2. Inspect things to ensure I'm not doing anything nefarious, or if you'd prefer, you can nuke the package.json and package-lock.json files
  3. Run npm install in the Repro folder (or npm install [email protected] if you nuked the package files)
  4. Run npx tsc in the Repro folder

klylesatepic avatar May 22 '25 21:05 klylesatepic

I'm making some changes across our (large) codebase, and keep running into this instead of the underlying compilation error(s). It's making it more difficult to fix the errors, since I have to go figure out what they are before I can fix them.

Do you need anything else from me to be able to fix this?

klylesatepic avatar Jun 26 '25 17:06 klylesatepic

Thanks for the ping, that's super minimal

RyanCavanaugh avatar Jun 27 '25 04:06 RyanCavanaugh