It took me a couple of minutes to understand the report, but I think I understood it :)
Does this happen in a current version of Pywikibot? If not, can you please update and try again?
Current version (downloaded 18 dec 22). I tried adding message manually in i18n/en.json but its just pops up new error message
18 dec 22 is not so new. Please try updating from Gerrit and running again.
I'm really not a big expert on pywikibot, but from what I know, its users usually update from Gerrit and rely more on the Gerrit version number based on the last commit. If you got pywikibot from Gerrit, you can check it by running
git log -1.
As far as I can see, the usage of the message "cosmetic_changes-append" has changed recently, and I think that if you update to the latest version from Gerrit, the problem will be fixed.
If you try this and it's still not fixed, then I'll try to involve pywikibot developers.