I'm trying to follow the steps in the Esri blog post Updating your hosted feature services with ArcGIS Pro and the ArcGIS API for Python but am running into an error.

To test this I published a simple stand-alone file GDB into an ArcGIS Online web map using ArcGIS Pro's UI tools. This creates a Service Definition, WebMap and associated Feature Layer on ArcGIS Online.

I then made a simple symbology change in ArcGIS Pro and attempted to push the updates to ArcGIS Online using the script. The script runs correctly as far as these lines:

sdItem = gis.content.search(query="title:"+ sd_fs_name + " AND owner: " + user, item_type="Service Definition")[0]

I can confirm from the timestamps on ArcGIS Online that the Service Definition has been updated, but the script is falling over when trying to update the associated Feature Layer. The script contains this line:

fs = sdItem.publish(overwrite=True)

This gives me the error message

RuntimeError: User cant overwrite this service, using this data, as this data is already referring to another service

I can confirm that the data doesn't actually refer to another service since it's coming from a stand-alone file GDB that isn't used anywhere else. I'm using the same ArcGIS Online administrator's login within ArcGIS Pro and the Python script so I'm definitely the owner of the layer.

How can I overwrite the feature layer using the latest changes in the ArcGIS Pro document?


I had this problem due to changing the source name in the map doc after publishing the service. Thus, the source name in the service was different from the source name in the map doc. I had to look at the feature's Rest page to determine the original source name used when the feature service was published and changed the map doc to match.

| improve this answer | |
  • I changed the name of my layer and got this error. I changed it back to the original name...and I still get the error. Uh oh... – Steve Scott Feb 4 at 21:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.