question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RangeError: Maximum call stack size exceeded

See original GitHub issue

Hello there!

I recently switched from JavaScript to TypeScript. I always liked Prettier to keep a consistent code style. I found your extension very promising but I ran into an issue when using it.

I have several plugins and packages on my TypeScript project but after trying for a long time, I was able to reproduce it and it definitely is caused by your plugin since it works without it.

When I save a TS file in my larger TS project, it won’t be formatted at all. It seems like prettier crashes completely. I have a little exclamation mark in the task bar next to the prettier label and if I click on it, the following message appears:

["ERROR" - 7:38:37 PM] Error formatting document.
RangeError: Maximum call stack size exceeded

The whole log can is here: log.log

Although it says “Formatting completed” at the end, nothing happens. And this doesn’t happen without this plugin.

Versions: organize imports: v1.1.1 prettier: v2.2.1 VSCode: 1.52.1 OS: Windows 10 64 bit 2004 but my TS project is living in a WSL2 environment running on Ubuntu 20.04

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
DAmNRelentlesscommented, Jan 8, 2021

It looks like I am not able to reproduce this behavior anymore. I reinstalled the plugin and tried running prettier from the command line like you said and it worked.

After that, I tried auto-formatting by saving again but it worked without any error. Really odd. I reinstalled my OS in the last few days because I had problems with the update and that seems to have fixed it for now.

I will reopen the issue if I am able to reproduce this again. Thanks for your help!

0reactions
simonhaenischcommented, Jan 7, 2021

Ok I’m using similar versions (same prettier, same plugin, same typescript, and Node 15.3), and everything works fine for me (however I’m on macOS).

What you can try to do is invoke prettier from the command line in your project:

npx prettier --write path/to/some/file.ts

If that runs into the same issue, then at least we know it’s not related to VS Code. In that case, can you also try to create a clean project and see whether it reproduces?

mkdir organize-imports-test
cd organize-imports-test

npm init -y
npm install --save-dev prettier prettier-plugin-organize-imports

touch file.ts

npx prettier --write file.ts
Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Maximum call stack size exceeded error
It means that somewhere in your code, you are calling a function which in turn calls another function and so forth, until you...
Read more >
JavaScript Error: Maximum Call Stack Size Exceeded
If you see the “Maximum Call Stack Size Exceeded” error, there's likely a problem with a recursive function within your JavaScript code.
Read more >
RangeError: Maximum call stack size exceeded - Educative.io
The most common source for this error is infinite recursion. You must have a recursive function in your code whose base case is...
Read more >
Uncaught RangeError: Maximum call ... - Net-Informations.Com
This error is almost always means you have a problem with recursion in JavaScript code, as there isn't any other way in JavaScript...
Read more >
How to fix: "RangeError: Maximum call stack size exceeded"
A "RangeError: Maximum call stack size exceeded" is an error that occurs when a function or operation tries to execute too many nested...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found