Offline Map Sync Error: Job error 6004 \"invalid start of json - expecting { or [\". < : 0."

134
2
a week ago
Highlighted
MVP Regular Contributor

I get this error on a regular basis when syncing an offline map.  I have noticed it seems to occur when I sync soon after opening a map, and before I have loaded the map into a MapView.  I do check to confirm the map and all layers have a LoadStatus = Loaded.

{
	"isServerMessage": false,
	"message": "Layer result: Sync failed. Name: LayerName LayerID: 9 TableName: ... URL: https://services3.arcgis.com/..../arcgis/rest/services/..../FeatureServer/9 Job error 6004 \"invalid start of json - expecting { or [\". < : 0.",
	"severity": "warning",
	"timestamp": 1605810526949
}

The was this post a couple years ago: https://community.esri.com/t5/arcgis-runtime-sdk-for-android/quot-invalid-start-of-json-expecting-or...

But no resolution ever presented

Reply
0 Kudos
2 Replies
Highlighted
MVP Regular Contributor

Anything?  This is to where it seems to happen the first time we sync the map no matter what

@MichaelBranscomb 

@MortenNielsen 

Reply
0 Kudos
Highlighted
Esri Frequent Contributor

Hi Joe,

Without a repro it's difficult to tell, but it appears to be returning something other than the expected JSON response, perhaps HTML. Could it be authentication-related? (although a challenge should trigger the registered Authentication Manager challenge)

You could (for debugging purposes only), add an event handler for the response end event and log the responses.

e.g.

Register handler:

 

ArcGISHttpClientHandler.HttpResponseEnd += OnHttpResponseEnd;

 

 

Event handler:

 

private async void OnHttpResponseEnd(object sender, HttpResponseEndEventArgs e)
{
    using (e.GetDeferral())
    {
        // Await the original response
        var oldContent = e.Response.Content;
        var bytes = await oldContent.ReadAsByteArrayAsync().ConfigureAwait(false);
                
        // Get the response string
        string responseString = Encoding.ASCII.GetString(bytes);
        // TODO : Log the response
        // e.g. Use a TextWriterTraceListener and call Trace.TraceInformation(responseString);

        // Wrap it in a new ByteArrayContent so it can be consumed again
        var newContent = new ByteArrayContent(bytes);
        foreach (var header in oldContent.Headers)
            newContent.Headers.TryAddWithoutValidation(header.Key, header.Value);
        e.Response.Content = newContent;
    }
}

 

 

Thanks

Mike

Reply
0 Kudos