'This document is published but its URL cannot be routed' and exception clicking on the info tab in content

When I click on the ‘info’ button in any content, new or old, within an upgraded Umbraco 17 project an error is throw and the ‘Links’ section shows ‘This document is published but its URL cannot be routed’

The content was imported from a Umbraco 13 project.

This error is consistently thrown in the logs.

Could not register redirects because the old route couldn't be retrieved for content ID {ContentId} and culture '{Culture}

An unhandled exception has occurred while executing the request.“,”@l":“Error”,“@x”:"System.InvalidOperationException: Wasn’t able to get an UmbracoContext\r\n at Umbraco.Extensions.UmbracoContextAccessorExtensions.GetRequiredUmbracoContext(IUmbracoContextAccessor

But IUmbracoContextAccessor was removed in Umbraco 17?

If I try to disable URL Tracker from /section/content/dashboard/redirect-management, i also get an exception

The JSON object contains a trailing comma at the end which is not supported in this mode. Change the reader options. LineNumber: 153 | BytePositionInLine: 4.\

I have added the following to the Startup.cs but I don’t think its relevant.

app.UseRouting();
app.UseAuthentication();

app.UseAuthorization();

I thought I had seen this sort of behaviour before where I had orphaned content in the database.