Errors
Unistyles will only throw errors when it is used incorrectly.
RuntimeUnavailable
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
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
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.
AdaptiveThemesNotSupported
This error is thrown if you try to use adaptive themes on unsupported platform like visionOS.
To fix this issue, you need to remove adaptiveThemes
options from UnistylesRegistry
.
ThemesCannotBeEmpty
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
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
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
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
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
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.