THIS IS ARCHIVED DOCUMENTATION

The RouteData must contain an item named ‘controller’ Error With SXA

Symptoms

You have added a Coveo Search Interface component to your SXA page.

You notice an error message in the Sitecore Experience Editor with the following stack trace.

Error Rendering View: /Views/Coveo Hive/Scopes/Sitecore Instance Filter.cshtml: Error while rendering view: '/Views/Coveo Hive/Scopes/Sitecore Instance Filter.cshtml' (model: 'Coveo.UI.Components.Models.Scopes.SitecoreInstanceFilterModel, Coveo.UI.Components').
   at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)
   at Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args)
Inner Exception: The RouteData must contain an item named 'controller' with a non-empty string value.
   at System.Web.Routing.RouteData.GetRequiredString(String valueName)
   at System.Web.Mvc.VirtualPathProviderViewEngine.FindPartialView(ControllerContext controllerContext, String partialViewName, Boolean useCache)
   at Sitecore.Mvc.InstrumentendViewEngine.InstrumentOperation(String operation, Func`1 findViewFunc)
   at Sitecore.Mvc.InstrumentendViewEngine.FindPartialView(ControllerContext controllerContext, String partialViewName, Boolean useCache)
   at System.Web.Mvc.ViewEngineCollection.Find(Func`2 lookup, Boolean trackSearchedPaths)
   at System.Web.Mvc.ViewEngineCollection.FindPartialView(ControllerContext controllerContext, String partialViewName)
   at System.Web.Mvc.HtmlHelper.FindPartialView(ViewContext viewContext, String partialViewName, ViewEngineCollection viewEngineCollection)
   at System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection)
   at System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
   at Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer)

When viewing the published page, you see a yellow error screen with the following details:

The RouteData must contain an item named 'controller' with a non-empty string value.
Description: An unhandled exception occurred.

Exception Details: System.InvalidOperationException: The RouteData must contain an item named 'controller' with a non-empty string value.

Source Error:


Line 28:                 <div class="CoveoForSitecoreBindWithUserContext"></div>
Line 29:                 <div class="CoveoForSitecoreSyntax"></div>
Line 30:                 @Html.Sitecore().Rendering(RenderingIDs.AUTOMATIC_BOOSTING, new {
Line 31:                     DataSource = @Model.ItemId
Line 32:                 })

Source File: c:\inetpub\wwwroot\sc9sxa.sc\Areas\CoveoHiveSxa\Views\Search Interfaces\Coveo Search Interface.cshtml    Line: 30

Stack Trace:


[InvalidOperationException: The RouteData must contain an item named 'controller' with a non-empty string value.]
   System.Web.Routing.RouteData.GetRequiredString(String valueName) +244
   System.Web.Mvc.VirtualPathProviderViewEngine.FindPartialView(ControllerContext controllerContext, String partialViewName, Boolean useCache) +108
   Sitecore.Mvc.InstrumentendViewEngine.InstrumentOperation(String operation, Func`1 findViewFunc) +121
   Sitecore.Mvc.InstrumentendViewEngine.FindPartialView(ControllerContext controllerContext, String partialViewName, Boolean useCache) +289
   System.Web.Mvc.ViewEngineCollection.Find(Func`2 lookup, Boolean trackSearchedPaths) +117
   System.Web.Mvc.ViewEngineCollection.FindPartialView(ControllerContext controllerContext, String partialViewName) +203
   System.Web.Mvc.HtmlHelper.FindPartialView(ViewContext viewContext, String partialViewName, ViewEngineCollection viewEngineCollection) +57
   System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection) +225
   System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +136
   Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer) +257

[InvalidOperationException: Error while rendering view: '/Views/Coveo Hive/Scopes/Automatic Boosting.cshtml' (model: 'Coveo.UI.Components.Models.Scopes.AutomaticBoostingModel, Coveo.UI.Components').
]
   Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer) +729
   Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Render(Renderer renderer, TextWriter writer, RenderRenderingArgs args) +147
   Sitecore.Mvc.Pipelines.Response.RenderRendering.ExecuteRenderer.Process(RenderRenderingArgs args) +74
   (Object , Object ) +14
   Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +484
   Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists) +236
   Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +22
   Sitecore.Mvc.Pipelines.PipelineService.RunPipeline(String pipelineName, TArgs args) +195
   Sitecore.Mvc.Helpers.SitecoreHelper.RenderRendering(Rendering rendering) +61
   ASP._Page_Areas_CoveoHiveSxa_Views_Search_Interfaces_Coveo_Search_Interface_cshtml.Execute() in c:\inetpub\wwwroot\sc9sxa.sc\Areas\CoveoHiveSxa\Views\Search Interfaces\Coveo Search Interface.cshtml:30
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +252
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +148
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +122
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +375
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +88
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +775
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +775
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +81
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +701

Cause

An SXA page breaks when the rendering is located at the root of the page and it calls @Html.Sitecore().Rendering.

Resolution

To insert a non-SXA Coveo-powered search interface component in the Experience Editor

  1. In the Experience Editor, insert a Sitecore Container or a splitter component.
  2. Insert your Coveo-powered search interface component within the container component inserted in step 1.