Friday, January 26, 2018

Error in Sitecore SXA theme selection

Problem

While working on SXA in Sitecore 9, I was facing an error in Sitecore experience editor where i was trying to select a theme. But it was throwing below error

Server Error in '/' Application.

End of string expected at position 51.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Sitecore.Data.Query.ParseException: End of string expected at position 51.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

[ParseException: End of string expected at position 51.]
   Sitecore.Data.Query.QueryParser.Raise(String error) +203
   Sitecore.Data.Query.QueryParser.DoParse(String query) +83
   Sitecore.Pipelines.GetLookupSourceItems.ProcessQuerySource.Process(GetLookupSourceItemsArgs args) +163
   (Object , Object[] ) +71
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +469
   Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
   Sitecore.Web.UI.HtmlControls.Data.LookupSources.GetItems(Item current, String source) +459

[LookupSourceException: Invalid lookup source "query:$compatibleThemes": End of string expected at position 51..]
   Sitecore.Web.UI.HtmlControls.Data.LookupSources.GetItems(Item current, String source) +623
   Sitecore.XA.Foundation.SitecoreExtensions.CustomFields.FieldTypes.LookupNameLookupValue.GetValueHtmlControl(String id, String value) +198
   Sitecore.XA.Foundation.SitecoreExtensions.CustomFields.FieldTypes.LookupNameLookupValue.BuildParameterKeyValue(String key, String value) +519
   Sitecore.XA.Foundation.SitecoreExtensions.CustomFields.FieldTypes.LookupNameLookupValue.BuildControl() +362
   System.Web.UI.Control.LoadRecursive() +68
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.AddedControl(Control control, Int32 index) +11890468
   Sitecore.Web.UI.Sheer.ClientPage.AddControl(Control parent, Control control, String placeholder) +233
   Sitecore.Shell.Applications.ContentEditor.EditorFormatter.AddEditorControl(Control parent, Control editor, Field field, Boolean hasRibbon, Boolean readOnly, String value) +241
   Sitecore.Shell.Applications.ContentEditor.EditorFormatter.RenderField(Control parent, Field field, Item fieldType, Boolean readOnly, String value) +1490
   Sitecore.Shell.Applications.ContentEditor.EditorFormatter.RenderField(Control parent, Field field, Item fieldType, Boolean readOnly) +185
   Sitecore.Shell.Applications.ContentEditor.EditorFormatter.RenderField(Control parent, Field field, Boolean readOnly) +380
   Sitecore.Shell.Applications.ContentEditor.EditorFormatter.RenderSection(Section section, Control parent, Boolean readOnly) +252
   Sitecore.Shell.Applications.ContentEditor.EditorFormatter.RenderSections(Control parent, Sections sections, Boolean readOnly) +173
   (Object , Object[] ) +71
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +469
   Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
   Sitecore.Shell.Applications.ContentManager.Editor.Render(RenderContentEditorArgs args, Control parent) +558
   Sitecore.Shell.Applications.ContentManager.FieldEditorForm.RenderEditor(Border parent) +388
   Sitecore.Shell.Applications.ContentManager.FieldEditorForm.UpdateEditor() +187
   Sitecore.Shell.Applications.ContentManager.FieldEditorForm.OnPreRendered(EventArgs e) +37

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
   System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +210
   System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +146
   Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj) +89
   Sitecore.Shell.Applications.ContentManager.FieldEditorPage.OnPreRender(EventArgs e) +164
   System.Web.UI.Control.PreRenderRecursiveInternal() +110
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3624


Solution

The issue was, I named my theme as "company-site". Please note "-" hyphen in between the name, which caused the fast query used to fetch theme names fail and was throwing above error. I renamed the them and it all started working


No comments:

Post a Comment