# Error: SettingsService is in unnamed module of loader

**URL:** <https://platform.jetbrains.com/t/error-settingsservice-is-in-unnamed-module-of-loader/2212>\
**Category:** IntelliJ Platform\
**Created:** [July 8, 2025, 7:23pm UTC](https://platform.jetbrains.com/t/error-settingsservice-is-in-unnamed-module-of-loader/2212 "2025-07-08T19:23:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonathanlermitage.1](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@jonathanlermitage.1](https://platform.jetbrains.com/u/jonathanlermitage.1)\
**Post date:** [July 8, 2025, 7:23pm UTC](https://platform.jetbrains.com/t/error-settingsservice-is-in-unnamed-module-of-loader/2212/1 "2025-07-08T19:23:06Z")

</div>

Hi,

I persist some settings via

```auto
package lermitage.intellij.extratci;
...
@State(
    name = "ExtraTciSettings",
    storages = @Storage(value = "lermitage-extratci.xml", roamingType = RoamingType.DEFAULT),
    category = SettingsCategory.PLUGINS
)
public class SettingsService implements PersistentStateComponent<SettingsService> {

    public static SettingsService getInstance() {
        return ApplicationManager.getApplication().getService(SettingsService.class);
    }

    @Override
    public SettingsService getState() {
        return this;
    }

    @Override
    public void loadState(@NotNull SettingsService state) {
        XmlSerializerUtil.copyBean(state, this);
    }

    //public fields, getters and setters...
}

```

I need to read a setting from an `AppLifecycleListener`. I cannot reproduce myself, but some users reported errors like this:

```auto
Caused by: java.lang.ClassCastException: class lermitage.intellij.extratci.SettingsService cannot be cast to class lermitage.intellij.extratci.SettingsService (lermitage.intellij.extratci.SettingsService is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @5ab32ef6; lermitage.intellij.extratci.SettingsService is in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @73ef13e9)

```

This happens when executing `SettingsService.getInstance()`.

This appeared with 2025 IDEs, like IntelliJ, Rider, WebStorm… on any OS.  
I know an `AppLifecycleListener` is called very early, and some components are not ready (like the license facade), but I never noticed any issue with `PersistentStateComponent`s. At least, until 2025 IDEs (again, I cannot reproduce by myself, for now).

Do you know how to fix that?

Some context: I need to get the license facade in order to know if a user has a valid license for my plugin. If so, I register an `IconPathPatcher`. Unfortunately, I need to do that in an `AppLifecycleListener` (otherwise, it’s too late for registering the `IconPathPatcher`) and the license facade is not ready yet.  
As a workaround, I postpone the license check (~5 seconds later), and I save the license status in settings. I read this setting on the next IDE start.  
This is why I’m reading my settings on IDE start, in an `AppLifecycleListener`. Unfortunately, some users are facing an error with that. I don’t understand the error. It seems to be about modules and classloaders, but I do not touch these things…

Thanks
