Tip Sitecore General link picker 404 error

Created: 26 Sep 2022, last update: 31 Oct 2022

Tip: Sitecore General link picker 404 error

When your Sitecore General link picker is broken and the dialog box gives a 404 error, than a possibility is that the search query has become too long.

You can check that by taking a look at the network tab in the developer tools of your web browser. Check the url that gives a 404 and look at the size, especially the length of the querystring.

With IIS requestFiltering the default value of maxQueryString is 2048
See IIS request limits

When you hit this limit you can obviously think of how you get your querystring shorter. When you use cross-site linking in Sitecore SXA with many linkable sites, then you can perhaps adjust this.
See Sitecore SXA adjust link settings to enable cross site linking

Or you increase the value of the max url querystring length. You can do this by Web.config transformations, xdt:Transform.
For Sitecore Containers See: Applying configuration transforms

Example for the CM server increases the max querystring from 2KB to 8KB

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits xdt:Transform="SetAttributes(maxQueryString)" maxQueryString="8192"/>
      </requestFiltering>
    </security>
  </system.webServer>
  <system.web>
    <httpRuntime xdt:Transform="SetAttributes(maxQueryStringLength)" maxQueryStringLength="8192"/>
  </system.web>
</configuration>

Beside patching the requestFiltering limits you should also set the httpRuntime maxQueryStringLength to an appropriate length. The default value is also 2048. The above xdt set both, you have to modify only the CM.