Since the roll-out of the new Add item interface in AGOL, we've seen some buggy behavior while adding feature services from ArcGIS Server. In particular, the error happens when storing credentials to the service in the item when adding to AGOL.
ESRI support was able to replicate the error and is working on a hot fix.
We aren't having the same issue adding map services, those seem to work fine.
Have they shared the Bug Number? Please share here as well.
Meanwhile, have you tested the workflow in an incognito mode of browser?
If that doesn't work, add the Server URL to ArcGIS Online > Organization > Settings > Security > Trusted Server.
Have you tried the above steps?
We have experienced this bug for over a year and from have the latest portal, we have been told its being worked on for all this time from Dec 2020 to Dec 2021 now. Spent many many days with esri support on this one, still an open bug against AGO. To be clear this is when you have secure services running on an enterprise portal then using AGO to create an item with stored credentials to that service, editing will work but adding attachments will fail to the service.