I have the following script to overwrite an existing locator service, in a standalone ArcGIS Server (10.9.1)
I'm getting the following error when creating the sd draft file

Below is the code
from arcgis.gis import server
import arcpy
import pprint
## Overwrite any existing outputs
arcpy.env.overwriteOutput = True
EGServer = server.Server(url=f"https://arcgisserver/arcgis/admin", username, password)
print(' Connected to Server')
## Create sd draft file
LocFolder = "\\\\locators\\EnerGov\\ElasticSearch"
sdFile ="\\\\c$\\Users\\AppData\\Local\\ESRI\\ArcGISPro\\\\Staging\\ arcgis\\ElasticSearchLocator.sd"
sddraftFile ="\\\\c$\\Users\\AppData\\Local\\ESRI\\ArcGISPro\\Staging\\arcgis\\ElasticSearchLocator.sddraft"
service_name = "ElasticSearchLocator"
summary = "Locator for EnerGov's elastic search"
tags = "EnerGov, locator, elastic search"
## server_connection_file has agssite login
server_connection_file = "\\\\EnerGov\\admin on arcgis.ags"
print('Creating SD draft file')
analyze_messages = arcpy.CreateGeocodeSDDraft(LocFolder,sddraftFile,service_name,server_type='ARCGIS_SERVER',
connection_file_path=server_connection_file, copy_data_to_server=True,
summary=summary, tags=tags, max_result_size=500, max_batch_size=1000,
suggested_batch_size=1000, overwrite_existing_service=True)
print(arcpy.GetMessages())
## Stage and upload the service if the sddraft analysis did not contain errors
if analyze_messages['errors'] == {}:
try:
## Convert sddraft file to a service definition (sd) file
print('Staging service')
arcpy.StageService_server(sddraftFile, sdFile)
print(' Staging Service ' + arcpy.GetMessages())
## Publish service definition (sd) file as a service
print('Publishing locator')
arcpy.UploadServiceDefinition_server(sdFile, EGServer)
print(' Publishing Service ' + arcpy.GetMessages())
except:
message = arcpy.GetMessages()
else:
# if the sddraft analysis contained errors, display them
print("Error were returned when creating service definition draft")
pprint.pprint(analyze_messages['errors'], indent=2)
print("Done!!")The code was originally shared by ArcGIS Geocoding Team here
Any pointers would be appreciated.