It seems a Nextcloud bug.
As a workaround you could export and import the share config as explained here: Failed update on NS7.9 to NS8 migrated NextCloud - #42 by mrmarkuz
See also [Bug]: Can't save global credentials in external storage · Issue #49829 · nextcloud/server · GitHub