999999 error on StageService_server()

10-10-2019 11:07 AM
New Contributor III
Oh, the dredded 999999 error. I am trying to create a service definition in arcpy for ArcGIS Pro. I succeed in creating a .sddraft but I fail to create a .sd
#create draft
analysis = {}
   analysis = sharing_draft.exportToSDDraft(sddraft_output_filename)
   print("draft export success")
except Exception as e:
   print("Draft export failed: {}".format(e))
if analysis is not None:
   print("analysis: " + str(analysis.values))
   print("draft analysis has no errors")

#create .sd file
sd_output_filename = outdir + sd_filename
print("sd_output_filename:" + sd_output_filename)
   arcpy.StageService_server(sddraft_output_filename, sd_output_filename)
   print("stage successful")
except Exception as e:
   print("stage failed:{}".format(str(e)))

I get the following output

draft export success
draft analysis has no errors
stage failed:ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds.
Failed to execute (StageService).

The draft has no errors...or does it? I am using double backslash the paths. I looked at this answer: (https://community.esri.com/thread/90453) but it is from 2014.


I am trying to publish an .mxd to our internal portal.

Which should I use?

sharing_draft = mlist[0].getWebLayerSharingDraft("FEDERATED_SERVER", "MAP_IMAGE", "Active_Projects")
sharing_draft = mlist[0].getWebLayerSharingDraft("HOSTING_SERVER", "FEATURE", "Active_Projects")
Tags (1)
0 Kudos
3 Replies
New Contributor III

What is the difference between UploadServiceDefinition_Server and gis.content.add?

0 Kudos
New Contributor

Did you ever get this to work? I've run into 99999 with the same step and have no explanation.

0 Kudos
New Contributor II

I hope this helps someone out there.  I solved a half-day of banging my head against the wall with one silly line of code:


If you make any changes, save them before publishing.