Select to view content in your preferred language

Portal content cloning error: 'ItemCreateException' - Item already exists

84
0
Tuesday
ademshark
Occasional Contributor

I am attempting to use the ArcGIS API for Python to clone items from one of our enterprise portals to another. It's a very straightforward piece of code that accesses the portals in question, searches one portal, then clones the items found within that other portal. I found this workflow on an Esri website: https://developers.arcgis.com/python/latest/guide/cloning-content/

Here is my snippet, it's been generalized so if syntax is off assume it works (it has worked to this point)

    developmentPortal = GIS(url, credentials)
    testPortal= GIS(url, credentials)

    toClone = developmentPortal.content.search(query='xyz')
    for item in toClone:
        print(item)

   testPortal.content.clone_items(items=dev_items)

-----

Over the last few days of using this, sometimes it has worked and all my content gets cloned into another portal, and while refining the script and testing the cloning, sometimes it doesn't. It seems like even when I delete content from the portal in question to reattempt clone, something is hanging out in the background. Now, I am getting this error:

_ItemCreateException: ("Failed to create Feature Service 'xyz': Service name 'xyz' already exists for '0123456789ABCDEF'\n(Error Code: 0)", None)

I have tried using various parameters on the clone_items() function, but nothing seems to work. The items cannot be overwritten. They do not exist on my Portal, nor do they exist in the server (checking via Server Manager and the REST directory). Thanks in advance.

0 Kudos
0 Replies