I have a script to overwrite an existing locator service, in a standalone ArcGIS Server (10.9.1) The code was originally shared by ArcGIS Geocoding Team here
I'm getting the following error when creating the sd draft file

I already checked and all my paths are correct. Any ideas?
import arcpy
import pprint
from arcgis.gis import server
## Sign in to server
# this connects to a standalone server that has web adaptor installed
EGServer = server.Server(url=f"https://arcgis:6443/arcgis/admin", username, password)
print(' Connected to server')
# Overwrite any existing outputs
arcpy.env.overwriteOutput = True
locator_path = "\\\\xyz\\xyz\\arcgissource\\locators\\EnerGov\\ElasticSearch"
sdDraft ="\\\\xyz\\xyz\\arcgissource\\locators\\EnerGov\\ElasticSearch\\ElasticSearchLocator.sddraft"
sd_file = "\\\\xyz\\xyz\\arcgissource\\locators\\EnerGov\\ElasticSearch\\ElasticSearchLocator.sd"
service_name = "ElasticSearchLocator"
summary = "Locator for EnerGov's elastic search"
tags = "EnerGov, locator, elastic search"
## server_connection_file has agssite login
server_connection_file = "\\\\xyz\\xyz\\arcgissource\\locators\\EnerGov\\admin on arcgis_6443.ags"
# Create the sd draft file
analyze_messages = arcpy.CreateGeocodeSDDraft(locator_path, sdDraft, service_name,
server_connection_file, copy_data_to_server=True, summary=summary,
tags=tags, max_result_size=20,max_batch_size=500,
suggested_batch_size=150, overwrite_existing_service=True)
print("Creating SD Draft file")
print(arcpy.GetMessages())
## Stage and upload the service if the sddraft analysis did not contain errors
if analyze_messages['errors'] == {}:
try:
# Execute StageService to convert sddraft file to a service definition
# (sd) file
arcpy.StageService_server(sdDraft, sd_file)
# Execute UploadServiceDefinition to publish the service definition
# file as a service
arcpy.UploadServiceDefinition_server(sd_file, EGServer)
print("The geocode service was successfully published")
except arcpy.ExecuteError:
print("An error occurred")
print(arcpy.GetMessages(2))
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)