I have a series of WorkSpaces that run in sequence (via WorkSpace Callers). I have the main WorkSpace scheduled to run a few times a day, and over the last few weeks they've been running fine.
Today I noticed some of them began to fail, and throw the same error that I would sometimes get when I set them up the first time, a few months ago:
Encountered an unexpected error. The error code from the server was 'none' and the message was: 'Service name 'SERVICE' already exists for 'xxxxxx''.
Of the 5 Workspaces that write to AGOL, 4 started to fail. One is working fine. All have the same settings, use "Insert" and "Truncate".
Looking deeper in to the logs, I found that for all of the writers that are failing the following is happening (some names redacted):
ArcGIS Online Feature Service Writer: Requesting portal information
ArcGIS Online Feature Service Writer: Getting list of user content items in 'User_org'
ArcGIS Online Feature Service Writer: Searching for all groups in the organization accessible to user 'User_org'
ArcGIS Online Feature Service Writer: Could not find a Feature Service item matching the Feature Service directive 'User_org/Service_Name'. A new Feature Service will be created
I think that's where it begins to fail. Further down in the logs I see that the FME starts to create a new File Geodatabase - something that does not happen when the translation succeeds.
ArcGIS Online Feature Service Writer: Uploading File Geodatabase dataset as an Item named 'Service_Name'
ArcGIS Online Feature Service Writer: Publishing Feature Service using Item named 'Service_Name', Target SR is WKID 102100
ArcGIS Online Feature Service Writer: Deleting Item 'Service_Name'
ArcGIS Online Feature Service Writer: Encountered an unexpected error. The error code from the server was 'none' and the message was: 'Service name 'Service_Name' already exists for 'xxxxxxxxxx''. Details: ''
ARCGISONLINEFEATURES writer: A fatal error has occurred. Check the logfile above for details
So it seems that FME doesn't find the existing service, decides to create it, but then is surprised that it already exists and can't create/upload the new one.
Then I noticed one thing different in the translation that succeeds: it updates the token to AGOL:
ArcGIS Online Feature Service Writer: Requesting portal information
Updating access token for 'user.name Esri ArcGIS Online'
ArcGIS Online Feature Service Writer: Getting list of user content items in 'User_org'
Apart from this difference, all translations / writers / parameters are the same:
- same authenticated connection
- same writer parameters (Insert, truncate)
- etc.
So in short:
Translations that fail:
- Connect to Portal
- Searches user's content for existing service
- Proceeds to search all accessible groups in organization for existing service
- Doesn't seem to find it. Decides to create it.
- When writing/uploading, AGOL says it already exists.
- Fatal error
Translations that succeed:
- Connect to Portal
- Request new token
- Searches user's content for existing service
- Finds and updates it
If I delete the existing service, the translation succeeds.
I found that there's a custom transformer that allows on to update the token, it requires user name and password (I authenticate via single sign-on).
Besides, I'm not sure that (the token) is the cause: I re-authenticated the connection via FME settings, and that didn't make a difference. And, it's the same authentication used for both the translations that succeed and the ones that fail.
Any ideas? Why doesn't FME find the existing service? Why does one translation request a new token and the others don't? Why some translations that worked very well for weeks suddenly start to fail?
Thanks!