When overwriting a hosted feature layer in ArcGIS Online through the Update Data option or using the overwrite() method within the publish() Python methods, the process or script fails and returns the following error:
Error: User cant overwrite this service, using this data, as this data is already referring to another service.
The hosted feature layer is overwritten using a file containing data with a different name than the original name. The display name can be edited to a different name, while the original name remains the same in the ArcGIS REST Services Directory. The uploaded file must follow the name within the ArcGIS REST Services Directory.
To solve the issue and successfully overwrite the hosted feature layer, ensure the file name matches the name specified in the ArcGIS REST Services Directory. The following steps describe how to locate the hosted feature layer name: