EPiServer Search errors: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value

Vote:
 

We noticed that the site search had stopped indexing and tried to restart it, but all we get are JsonReaderExceptions and errors on IndexService trying to reset the index.

We’ve been trying to debug but aren’t able to get any useful information. Our current ide is that some page is throwing an error that’s being parsed as Json. But we cant find what page or how to debug this.

2017-12-11 09:38:54,513 [31] ERROR EPiServer.Search.IndexingService.IndexingService: Reset of index: '' failed. Index not found!
2017-12-11 09:38:54,514 [18] ERROR EPiServer.Search.Internal.RequestHandler: Could not reset index '' for service uri 'http://xxxx.yyy/IndexingService/IndexingService.svc/reset/?namedindex=&accesskey=local'. Message: The remote server returned an error: (500) Internal Server Error.   at System.Net.HttpWebRequest.GetResponse()
   at EPiServer.Search.Internal.RequestHandler.MakeHttpRequest(String url, IndexingServiceReference indexingServiceReference, String method, Stream postData, Action`1 responseHandler)
   at EPiServer.Search.Internal.RequestHandler.ResetIndex(String namedIndexingService, String namedIndex)
2017-12-11 09:38:54,552 [18] ERROR EPiServer.Search.Internal.ReIndexManager: Failed to reindex of the service type: EPiServer.Search.Internal.ContentSearchHandlerImplementation
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: [. Path '', line 1, position 1.
   at Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType)
   at Newtonsoft.Json.JsonTextReader.ReadAsString()
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at EPiServer.Framework.Serialization.Json.Internal.JsonObjectSerializer.Deserialize(TextReader reader, Type objectType)
   at EPiServer.Framework.Serialization.ObjectSerializerExtensions.Deserialize(IObjectSerializer serializer, String value, Type objectType)
   at EPiServer.DataAccess.Internal.LazyPropertyValueLoader.SetValue(PropertyData property, PropertyDataRecord dataRecord, Func`3 valueConverter)
   at EPiServer.DataAccess.Internal.ContentListDB.ReadCustomProperties(DbDataReader reader, Dictionary`2 allFetchedItems, Boolean isReadingVersions)
   at EPiServer.DataAccess.Internal.ContentListDB.ReadPublishedList(DbCommand cmd)
   at EPiServer.Data.Providers.Internal.SqlDatabaseExecutor.<>c__DisplayClass31_0`1.b__0()
   at EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute[TResult](Func`1 method)
   at EPiServer.Core.Internal.DefaultContentProvider.BatchLoad(IList`1 contentLinks, Func`2 dbLoader)
   at EPiServer.Core.Internal.DefaultContentProvider.LoadContents(IList`1 contentReferences, ILanguageSelector selector)
   at EPiServer.Core.ContentProvider.GetContentBatch(IList`1 batch, ILanguageSelector selector, List`1& contents, Dictionary`2& contentMap)
   at EPiServer.Core.ContentProvider.GetScatteredContents(IEnumerable`1 contentLinks, ILanguageSelector selector)
   at EPiServer.Core.Internal.ProviderPipelineImplementation.GetItems(ContentProvider provider, IList`1 contentLinks, LoaderOptions loaderOptions)
   at EPiServer.Core.Internal.DefaultContentLoader.GetChildren[T](ContentReference contentLink, LoaderOptions loaderOptions, Int32 startIndex, Int32 maxRows)
   at EPiServer.Core.Internal.DefaultContentLoader.GetChildren[T](ContentReference contentLink, LoaderOptions loaderOptions)
   at EPiServer.Core.Internal.SlimContentReader.Next()
   at EPiServer.Search.Internal.ContentSearchHandlerImplementation.IndexPublishedContent()
   at EPiServer.Search.Internal.ReIndexManager.ReIndex()
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: [. Path '', line 1, position 1.
   at Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType)
   at Newtonsoft.Json.JsonTextReader.ReadAsString()
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at EPiServer.Framework.Serialization.Json.Internal.JsonObjectSerializer.Deserialize(TextReader reader, Type objectType)
   at EPiServer.Framework.Serialization.ObjectSerializerExtensions.Deserialize(IObjectSerializer serializer, String value, Type objectType)
   at EPiServer.DataAccess.Internal.LazyPropertyValueLoader.SetValue(PropertyData property, PropertyDataRecord dataRecord, Func`3 valueConverter)
   at EPiServer.DataAccess.Internal.ContentListDB.ReadCustomProperties(DbDataReader reader, Dictionary`2 allFetchedItems, Boolean isReadingVersions)
   at EPiServer.DataAccess.Internal.ContentListDB.ReadPublishedList(DbCommand cmd)
   at EPiServer.Data.Providers.Internal.SqlDatabaseExecutor.<>c__DisplayClass31_0`1.b__0()
   at EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute[TResult](Func`1 method)
   at EPiServer.Core.Internal.DefaultContentProvider.BatchLoad(IList`1 contentLinks, Func`2 dbLoader)
   at EPiServer.Core.Internal.DefaultContentProvider.LoadContents(IList`1 contentReferences, ILanguageSelector selector)
   at EPiServer.Core.ContentProvider.GetContentBatch(IList`1 batch, ILanguageSelector selector, List`1& contents, Dictionary`2& contentMap)
   at EPiServer.Core.ContentProvider.GetScatteredContents(IEnumerable`1 contentLinks, ILanguageSelector selector)
   at EPiServer.Core.Internal.ProviderPipelineImplementation.GetItems(ContentProvider provider, IList`1 contentLinks, LoaderOptions loaderOptions)
   at EPiServer.Core.Internal.DefaultContentLoader.GetChildren[T](ContentReference contentLink, LoaderOptions loaderOptions, Int32 startIndex, Int32 maxRows)
   at EPiServer.Core.Internal.DefaultContentLoader.GetChildren[T](ContentReference contentLink, LoaderOptions loaderOptions)
   at EPiServer.Core.Internal.SlimContentReader.Next()
   at EPiServer.Search.Internal.ContentSearchHandlerImplementation.IndexPublishedContent()
   at EPiServer.Search.Internal.ReIndexManager.ReIndex()
#186068
Dec 11, 2017 15:23
Vote:
 

Can you get past this error if you simply delete the folder containing the Lucene index instead of resetting it through the service?

#186096
Dec 12, 2017 14:29
Vote:
 

Ive done that, the folder is recreated with the segments-files but usaly no index. Once or twice a few other files appered but without any working search.

#186097
Dec 12, 2017 14:30
Vote:
 

Manually edit something in editor and publishing it makes that specific content searchable?

#186098
Dec 12, 2017 14:32
Vote:
 

Yeah you are right, i manualy edited and now .cfs files show up and i can search for what i just edited.

#186103
Dec 12, 2017 14:40
Vote:
 

Then the issue must be with the full indexer, by the look of the error message there is -something-, -somewhere- in your data that it chokes on. frown

I would have to recommend you to write your own indexer and debug it.

You only have to iterate over all your content and call ContentSearchHandler.UpdateItem(IContent).

#186107
Dec 12, 2017 14:45
Vote:
 

Ok, you don't think I can get what content the JSON parser is choking on? What comes after the "[".

Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: [. Path '', line 1, position 1.
#186110
Dec 12, 2017 15:03
Vote:
 

It's a long shot but you could try and see what the sql profiler catches.

There is a specific DDS for search that is stored in tblIndexRequestLog, but in there the entities are xml serialized and the way i read the stacktrace it chokes already when loading content from episerver.

#186111
Dec 12, 2017 15:22
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.