0

When I try to rebuild the link database I get the following error from the dialog:

Job started: RebuildLinkDatabasesIndex|System.UriFormatException: Invalid URI: The hostname could not be parsed.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at Sitecore.XA.Foundation.Multisite.LinkManagers.LocalizableLinkProvider.GetLocalizedUrl(Item item, String url, UrlOptions options)
at Sitecore.XA.Foundation.Multisite.LinkManagers.LocalizableLinkProvider.GetItemUrl(Item item, UrlOptions options)
at Sitecore.Xml.Xsl.LinkUrl.GetInternalUrl(Database database, String url, String itemID, String anchor, String queryString)
at Sitecore.Xml.Xsl.LinkUrl.GetUrl(XmlField field, Database database)
at Sitecore.Data.Fields.LinkField.get_InternalPath()
at Sitecore.Data.Fields.LinkField.ValidateLinks(LinksValidationResult result)
at Sitecore.Links.ItemLinks.AddLinks(Field field, List`1 links, ItemLinkState linkState)
at Sitecore.Links.ItemLinks.GetLinks(ItemLinkState linkState, Boolean allVersions, Boolean includeStandardValuesLinks)
at Sitecore.Links.ItemLinks.GetAllLinks(Boolean allVersions)
at Sitecore.Links.LinkDatabase.UpdateReferences(Item item)
at Sitecore.Links.LinkDatabase.RebuildItem(Item item)
at Sitecore.Links.LinkDatabase.RebuildItem(Item item)
at Sitecore.Links.LinkDatabase.RebuildItem(Item item)
at Sitecore.Links.LinkDatabase.RebuildItem(Item item)
at Sitecore.Links.LinkDatabase.RebuildItem(Item item)
at Sitecore.Links.LinkDatabase.RebuildItem(Item item)
at Sitecore.Links.LinkDatabase.RebuildItem(Item item)
at Sitecore.Links.LinkDatabase.RebuildItem(Item item)
at Sitecore.Links.LinkDatabase.RebuildItem(Item item)
at Sitecore.Links.LinkDatabase.RebuildItem(Item item)
at Sitecore.Links.LinkDatabase.RebuildItem(Item item)
at Sitecore.Links.LinkDatabase.RebuildItem(Item item)
at Sitecore.Links.LinkDatabase.Rebuild(Database database)
at Sitecore.Shell.Applications.Dialogs.RebuildLinkDatabase.RebuildLinkDatabaseForm.Builder.Build()|Job ended: RebuildLinkDatabasesIndex (units processed: )

I'm using Sitecore 8.2 with SXA. Possibly related; when I view the broken links report many of the broken links show a blank field. Presumably because the content was installed from a package including content and templates which had changed. So those blanks probably relate to removed template fields. It is possible there are orphaned field items lying around, but I'm not sure how I would delete those.

  • Have you tried Clean Up Database task before running Rebuild Link Database task? – Marek Musielak Apr 12 '17 at 12:54
  • I did, but I got this error Job started: RebuildLinkDatabasesIndex|System.UriFormatException: Invalid URI: The hostname could not be parsed. – Matthew Dresser Apr 12 '17 at 12:55
  • This one is your cause of trouble. Sitecore.XA.Foundation.Multisite.LinkManagers.LocalizableLinkProvider – Mark Cassidy Apr 12 '17 at 13:13
2

This problem was related to the site definition configuration. Our site mistakenly had multiple pipe-separated hostnames in the targetHostName property (it should have just one hostName value).

I found this out by decompiling the SXA assembly Sitecore.XA.Foundation.Multisite.dll and creating a copy of the class Sitecore.XA.Foundation.Multisite.LinkManagers.LocalizableLinkProvider with some additional exception handling and logging code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.