Good afternoon,
I am trying to overwrite an AGOL hosted feature class with API Python and testing it from ArcGIS Pro Notebook.
I am able to load the zipped FGDB in AGOL and overwrite the hosted feature class manually.
When I try to do the same thing with my program, selecting the same zipped FGDB, I get the following error message:
<Item title:"MyFGDB_3_gdb" type:Feature Layer Collection owner:xxxxxxxC>
item.type Feature Service
item.url https://services.arcgis.com/8Pc9XBTAsYuxx9Ny/arcgis/rest/services/MyFGDB_3_gdb/FeatureServer
item.title MyFGDB_3_gdb
Overwriting AGOL Hosted Feature Layer... ***************************** ERROR REPORT STARTS Tue 07/28/2026 03:45:40 PM > Error ocurred in: File "C:/Users/e160795/AppData/Local/Temp/ArcGISProTemp29860/xpython_29860/3605199246.py", line 73, in <module> item.publish(overwrite=True, file_type="fileGeodatabase") > Error Class is: <class 'Exception'> > Available error details are: Unable to analyze item. Item type'url' is not supported for anzlyzing, The item needs to be of type file (Error Code: 400) ERROR REPORT ENDS
This is my code:
# prepare signin object to AGOL
print ("Prepare signin object")
# This automatically logs you into the active AGOL/Portal session from ArcGIS Pro
gis = GIS("home")
# Verify your connection by printing your user details
print(f"Successfully logged in as: {gis.users.me.username}")
# publish Local File GEO DB
print ("Publish Local File GEO DB")
# --- Get the item ---
item = gis.content.get(item_id)
print(item)
print(f"item.type {item.type}")
print(f"item.url {item.url}")
print(f"item.title {item.title}")
print("Overwriting AGOL Hosted Feature Layer...")
# Update the item with the new zipped File Geodatabase
item.update(item_properties={}, data=zip_path)
# Publish the new data, overwriting the old service
item.publish(overwrite=True, file_type="fileGeodatabase")
print("Overwrite Completed:")