I have read many questions like this and have not found any resolution yet.
Recently after upgrade to 10.5.1, the custom print service on one of my arcgis servers is failing.
The print service is a geoprocessing service published using Export Web Map tool and uses some custom templates.
In one server machine, it works and in another it fails. Both arcgis servers are set identical interms of security and permissions to files and folders.
Error executing tool. Export Web Map