Thanks Aaron,
There's still the problem that the line gis.content.search won't run if type is specified, but if type is not specified then the sdItem.publish errors out.
Here is the error for including both type and id, as formatted in your response, with the one difference of passing in the id as a variable:
---------------------------------------------------
pydev debugger: starting (pid: 11304)
Creating SD file
Connecting to http://www.arcgis.com
Search for original SD on portal...
File "C:\GIS\PROJECTS\PLANNING\UpdateZoning&GPToMatchNewParcels\updateAGOL_Pro.py", line 109, in <module>
update("Zoning", "f78c18c992e74846806fc7dc98fb66f8")
File "C:\GIS\PROJECTS\PLANNING\UpdateZoning&GPToMatchNewParcels\updateAGOL_Pro.py", line 76, in update
sdItem = gis.content.search('type:"Service Definition" id:' + serviceItemID)[0]
IndexError: list index out of range
Here is the error when fileType is not specified:
------------------------------------------------------------------------
pydev debugger: starting (pid: 7432)
Creating SD file
Connecting to http://www.arcgis.com
Search for original SD on portal...
Found SD: Zoning, ID: f78c18c992e74846806fc7dc98fb66f8
Uploading and overwriting...
Overwriting existing feature service...
File "C:\GIS\PROJECTS\PLANNING\UpdateZoning&GPToMatchNewParcels\updateAGOL_Pro.py", line 110, in <module>
update("Zoning", "f78c18c992e74846806fc7dc98fb66f8")
File "C:\GIS\PROJECTS\PLANNING\UpdateZoning&GPToMatchNewParcels\updateAGOL_Pro.py", line 101, in update
fs = sdItem.publish(overwrite=True)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis.py", line 3125, in publish
if fileType == 'shapefile':
UnboundLocalError: local variable 'fileType' referenced before assignment