"Cannot add/update network before store is read!" when trying to save a WiFi network on Android 9 I cannot connect to WiFi on Android 9.

This is the error log

D/WifiService( 1941): recentFailure: Association Rejection code: 0
D/WifiService( 1941): uid=1000 name=android.uid.system:1000
WifiConfigManager( 1941): Cannot add/update network before store is read!
I had this issue after an updating of an Android 9 Pie custom ROM.
When trying to configure my wlan, I had error messages:

Failed to Save Network/ Wlan Netzwerk kann nicht gespeichert werden
Failed to connect to Network / Netzwerkverbindung konnte nicht hergestellt werden

Reset of network / WiFi / Bluetooth functions did not help.
Toggling static and dynamic IP address configuration did not help. WiFi manager did simply not accept and store entered WLAN configuration including password, etc.
Logcat brought up:
E WifiConfigManager: Cannot add/update network before store is read!

Further research brought up, that since Android 8 Oreo configuration of WiFi is, passwords, SSID, etc of known or configured networks are stored in /data/misc/wifi/WifiConfigStore.xml (previously wpa_supplicant.conf).
Owner is system:system with chmod 0600 privileges.
Checking this file with vi brought up garbage as contents in my case.
If the WifiConfigStore.xml file is damaged, the described error ensues, that the WifiConfigManager cannot read and update configuration.
Deletion of the file in this case recovers the situation, and Android spawns a new xml template. After a reboot I could enter wireless configuration data and connect.
Note that the config file may also be located in folder /data/misc_XX/wifi/ on some systems, with XX being some combination of two letters.