Getting the error below from the server logs.
GenerateGeodatabaseJob.JobChanged returns a status = "Failed".
GenerateGeodatabaseJob.Error.Message is null.
Code worked fine until a new service was published with some additional layers. Quick check on the layers, everything appears fine, other than 2 have quite a large extent (some points where created at 0,0).
Could this be causing the issue? We are working to resolve the extent issue, but wondering if there are any other ideas on paths to take to track down the culprit?
<Msg time='2017-03-13T15:42:24,395' type='SEVERE' code='20010' target='System/SyncTools.GPServer' methodName='GPServerSync.CheckMessages' machine='LAB-GISTEST.BLAH.COM' process='9096' thread='6876' user='cd36ded5-d290-47e1-8875-8766e6d17998' >Error executing tool. CreateFeatureServiceReplica Job ID: j46b13418aa2e4e8093a15586e6ea3867 : ErrorMsg@SyncGPService:{"code":400,"description":"Error while writing layer info in SqLite geodatabase."}
Failed to execute (Create Feature Service Replica).</Msg>
Code:
//Generate the Gdb and create the callback handler
Job<Geodatabase> gdbJob = gdbSyncTask.GenerateGeodatabase (gdbParameters, gdbPath);
gdbJob.JobChanged += (object sender, EventArgs evt) =>
#if WINDOWS_UWP
Debug.WriteLine("[GDB GENERATE STATUS MESSAGE] " + gdbJob.Status.ToString());
#else
Console.WriteLine("[GDB GENERATE STATUS MESSAGE] " + gdbJob.Status.ToString());
#endif
};
//Get the result
Geodatabase gdb = null;
try {
//Check for failed, and protect against a corrupt Gdb
if (gdbJob.Status.ToString().Trim().ToLower() != "failed")
gdb = await gdbJob.GetResultAsync ();
} catch { }
//Check the result
if (gdb == null) {
ToastHelpers.ShowError("Download Error", "Unable to download the selected feature data.\n\nError: " + gdbJob.Error.Message, 7);
}
else {
ToastHelpers.ShowSuccess("Map Data Download", "Successfully downloaded the map data for offline use.", 5);
}
I've confirmed this error also happens when using the CreateReplica REST API, so definitely not related to the SDK, but if anyone has ever encountered this or has ideas, please share.
I'm also not sure what changes in the additional layers caused server error or if this discussion would be of any help.
But maybe I can help with tracking the error message from your app...
Exception message from the job can be retrieved using job.Error when JobChanged is raised or exception caught from awaiting job.GetResultAsync().
You can also inspect job.Messages in JobChanged for detailed server error.
private void Job_JobChanged(object sender, EventArgs e)
{
var job = (GenerateGeodatabaseJob)sender;
if (job.Messages!= null && job.Messages.Count > 0)
{
var sb = new StringBuilder();
foreach (var m in job.Messages)
sb.AppendLine(m.Message);
System.Diagnostics.Debug.WriteLine(sb.ToString());
}
}
This is helpful, I'll give it a shot. I assume that job.Messages is an accumulation of all of the messages? It fires the "Started" messages many times, so in theory, I could check if the status failed, and then inspect the last message?
Also, after GetResultAsync, I was checking job.Error.Message, and this is null. I was sort of thinking if the job failed, then this would have some info. What is the intended use of the Error property on the job?
Thanks for your help.
You're right Job.Error.Message should not have been null.
I'm able to reproduce if where clause uses a field that does not exist in the service. Not the same error message as yours but still a server error that will prevent geodatabase from being generated.
Exception caught is of type ArcGISWebException but Exception.Message is null. JsonResponse includes the server error but is inaccessible to user.
var parameters = await task.CreateDefaultGenerateGeodatabaseParametersAsync(extent);
parameters.LayerOptions[0].WhereClause = "typeid = 5";
Thanks for reporting this bug, we'll try to get this fixed in future versions of the API.
For the meantime, you can use Job.Message, I see the error is reported there but did not bubble up correctly to Job.Error.Message
Error while handling generate geodatabase job status. Job error 500 Failed to create replica.
Thanks, this is better. I appreciate your help.
Now if only we could get more info rather than "Failed to create replica".....;-) Different topic, different thread, I know.
We have worked through the previous issue, but are now stuck on the "Failed to create replica" error. Will post once we figure it out in case others encounter this.
Once again, your help and responses are greatly appreciated.
Chad Yoder maybe you can give us a hand, we are facing a Collector (version 18 build 1031) error message when we try to download a service map we have published in AGOL (coming from our geodatabase in arcgis server in SQL Server (2012)).
The message is the same you have reported here : "Map Download Failed. The operation couldn't be completed. Error while writing layer info in SqLite geodatabase."
This haven't happened before with previous versions of Collector for the same kind of service map.
Thank you in advance.
OK the reason for the issue was due to archiving status of some items inside the geodatabase.
PS:
We use arcgis server 10.4.1 and this same desktop version.
Can you confirm none of the new layers are pointing to the same feature class as an existing layer