Get to know MDN better
The JavaScript exception "super() called twice in derived class constructor" occurs when the super() is called a second time for a given derived class constructor.
The super() call can only be called at most once for each new call to a derived class constructor. This is because super() is responsible for initializing the parent class, and calling it more than once would result in the parent constructor being called multiple times.
The best way to prevent this is to ensure that super() is placed outside of any control flow structure. Otherwise, make sure that all code paths in the constructor lead to only one super() call.
The super() call can be "saved" in an arrow function nested within the constructor. Then, when you call the arrow function, you will also call super(), and the same rule applies: the arrow function can only be called at most once.
Sometimes the bug may be more subtle.
Originally, flavors may never simultaneously include both "chocolate" and "vanilla", but if that ever happens, the constructor will call super() twice. You need to rethink about how your class should be structured to avoid this issue.
This page was last modified on Jul 8, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.