Problem/Motivation
Hi! When I go to /admin/config/counter/initial and try to save the configurations, my site breaks and I got the following error message:
The website encountered an unexpected error. Please try again later.
Drupal\Core\Config\ImmutableConfigException: Can not set values on immutable configuration counter.settings:counter_initial_counter. Use \Drupal\Core\Config\ConfigFactoryInterface::getEditable() to retrieve a mutable configuration object in Drupal\Core\Config\ImmutableConfig->set() (line 27 of core/lib/Drupal/Core/Config/ImmutableConfig.php).
I'm using Drupal 9.3.6 version.
Steps to reproduce
1) Go to /admin/config/counter/initial
2) Change the configurations that you want
3) Try to save
You will see the error message.
Proposed resolution
Get the config of the right way.
I was searching for solutions and I think use getEditable is the right way to solve this.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3269455-2.patch | 404 bytes | larisse |
Comments
Comment #2
larisse commentedOh, I notice that just add the config name in
getEditableConfigNamesfunction was sufficient to be able to save the changes. Here's a patch.Comment #3
Guilherme Rabelo commentedComment #4
Guilherme Rabelo commentedComment #5
Guilherme Rabelo commentedComment #6
Guilherme Rabelo commentedI don't know what happens with this all comments lol, but i will review this patch.
Comment #7
Guilherme Rabelo commentedThis last patch fixe the problem. Now its possible to save the initial configuration changes.
Moving to RTBC
Comment #8
gaurav.kapoor commentedThanks, @larisse and @Guilherme Rabelo for working on this. I have removed counter.initial array key and replaced it with counter.settings.
Comment #10
gaurav.kapoor commented