jss – Root element is missing exception when initiating a graphQL query

In Sitecore 10.0.0 with JSS 15.0.0 / 15.0.1, when we initiate a GraphQL query from the xGraph browser, we are getting the below exception. There is no impact to the experience editor or the content delivery though.

Query

{
  item(path: "/sitecore/content/home") {
    id
    ...on SampleItem {
      text {
        editable
      }
      title {
        editable
      }
    }
  }
}

How can we fix it?

788 17:13:55 ERROR Application error.
Exception: System.Xml.XmlException
Message: Root element is missing.
Source: System.Xml
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
   at System.Xml.XmlDocument.Load(XmlReader reader)
   at System.Xml.XmlDocument.LoadXml(String xml)
   at Sitecore.ExperienceEditor.Utils.WebUtility.FixEmptyPlaceholders(String layout)
   at Sitecore.ExperienceEditor.Utils.WebUtility.RenderLayout(Item item, HtmlTextWriter output, String siteName, String deviceId)
   at Sitecore.ExperienceEditor.Speak.Ribbon.PageExtender.RibbonWebControl.DoRender(HtmlTextWriter output)
   at Sitecore.Web.UI.WebControl.RenderAsText()
   at Sitecore.Mvc.ExperienceEditor.Pipelines.RenderPageExtenders.SpeakRibbon.RenderPageEditorSpeakExtender.Render(TextWriter writer)
   at Sitecore.Mvc.ExperienceEditor.Pipelines.RenderPageExtenders.RenderPageExtendersProcessor.Process(RenderPageExtendersArgs args)
   at (Object , Object )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
   at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
   at Sitecore.Mvc.ExperienceEditor.PageExtenderResponseFilter.GetExtendersHtml()
   at Sitecore.Mvc.ExperienceEditor.PageExtenderResponseFilter.get_ExtendersHtml()
   at Sitecore.Mvc.ExperienceEditor.Pipelines.Request.RequestEnd.AddPageExtenders.Process(RequestEndArgs args)
   at (Object , Object )
   at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
   at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
   at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
   at Sitecore.Mvc.Routing.RouteHttpHandler.EndProcessRequest(IAsyncResult result)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Read more here: Source link