Trying to use the code provided at the bottom of this entry overwrite feature class in arcgis online using python to overwrite an existing hosted feature layer in my ArcGIS Online content. I have zipped up a file geodatabase which contains one feature class.

The item.update command results in a True response

But, when I reach the publish command, I get an "error file_type must be provided".
I have tried many iterations of file_type (eg. fileType=fileGeodatabase, file_type=fileGeodatabase, etc) but keep getting various errors.

My code:

from arcgis.gis import GIS
gis = GIS(url="myarcgisonline", username="myusername",password="mypassword")
datafile = r"D:\....\upload.zip"
item = gis.content.get("the item id for my existing hosted feature layer")

The error:

Traceback (most recent call last): File "", line 1, in File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis_init_.py", line 10118, in publish raise ValueError("A file_type must be provide, data format not recognized") ValueError: A file_type must be provide, data format not recognized

How can I determine the correct syntax for the last item.publish command?

(I have tried using the editing setting of the hosted feature layer to both enabled and disabled)

2 Answers 2


Here is the update documentation.

Sometimes the fileType cannot be identified in which case, you can provide this parameter.


From the ESRI documentation linked by CaptDragon - there is an optional parameter you can add to specify a file type in item.publish().

So your publish command would look like:

item.publish(overwrite=True, file_type="serviceDefinition")

(Note: file_type not fileType)

Other valid values for file_type are: serviceDefinition, shapefile, csv, excel, tilePackage, featureService, featureCollection, fileGeodatabase, geojson, scenepackage, vectortilepackage, imageCollection, mapService, and sqliteGeodatabase

Using this optional parameter helped me get past the ValueError but resulted in a further unspecified error, so YMMV.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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