Errors
Unistyles will only throw errors when it is used incorrectly.
RuntimeUnavailable
“Unistyles runtime is not available. Make sure you followed the installation instructions”
This error will be thrown if you try to use Unistyles before it was initialized. Make sure you followed the installation setup.
Still getting this error? Check FAQ.
ThemeNotFound / ThemeNotRegistered
“You are trying to get a theme that is not registered with UnistylesRegistry”
and
“You are trying to set a theme that was not registered with UnistylesRegistry”
These errors occur when you call UnistylesRuntime.setTheme
with a theme that has not been registered with UnistylesRegistry
.
This situation can arise if you don’t use TypeScript. Confirm that all your themes are registered with UnistylesRegistry.addThemes
before using them.
ThemeNotSelected
“Your themes are registered, but you didn’t select the initial theme”
This error is thrown if you have registered multiple themes but failed to select an initial one.
Follow theming guide to learn how to select the initial theme.
ThemesCannotBeEmpty
“You are trying to register empty themes object”
This error occurs if you attempt to register an empty themes object with UnistylesRegistry.addThemes
.
The addThemes
method expects a key-value pair with at least one theme.
Follow theming guide to learn how to register your themes.
If you don’t want to use themes, simply don’t register them.
BreakpointsCannotBeEmpty
“You are trying to register empty breakpoints object”
This error will be thrown if you try to register empty breakpoints object with UnistylesRegistry.addBreakpoints
.
Breakpoints are optional, if you don’t want to use them, simply don’t register them.
BreakpointsMustStartFromZero
“You are trying to register breakpoints that don’t start from 0”
This error occurs when you attempt to register breakpoints that do not start from 0. Begin your first breakpoint with a value of 0 to mimic CSS cascade.
InvalidPluginName
“Plugin name can’t start from reserved prefix __unistyles”
This error is thrown if you attempt to register a plugin with a name that begins with the __unistyles
prefix.
This prefix is reserved for Unistyles’ internal plugins.
DuplicatePluginName
“You are trying to register a plugin with a name that is already registered”
This error occurs when you attempt to register a plugin with a name that has already been registered. Review your list of plugins. Perhaps you included the same plugin twice? Or, maybe a plugin with the same name has already been created by someone from the community?
CantRemoveInternalPlugin
“You are trying to remove an internal unistyles plugin”
This error is thrown if you attempt to remove an internal Unistyles plugin. Currently, it’s not possible to remove internal plugins as they are essential for Unistyles to function properly.