I had a similar problem couple of yearsr ago. If its not possible to remove the folder through the UI try to delete it manually
MariaDB [nextcloud]> select * from oc_share_external;
+----+----------------------+-----------+-----------------+----------+---------+--------+--------+------------+----------------------------------+----------+
| id | remote | remote_id | share_token | password | name | owner | user | mountpoint | mountpoint_hash | accepted |
+----+----------------------+-----------+-----------------+----------+---------+--------+--------+------------+----------------------------------+----------+
| 2 | http://XXXXXXX/cloud | -1 | duXXXXXXXmTlCBL | | /XXX | XXX | XXX | /XXX | 25ca74b23eb1e2eeb76a0dXXXX0ce4 | 1 |
+----+----------------------+-----------+-----------------+----------+---------+--------+--------+------------+----------------------------------+----------+