Unable to rebuild database cache

Heya folks!

I have this Umb13 site that’s experiencing some issues, our database cache has been corrupt or generally doesn’t feel great. When I go to the Published Status section of the backoffice I see this:

I’ve tried hitting the Rebuild button under the Database Cache section, and since you don’t really get any indication of progress here i’ve been forced to look in the database, here’s what I’ve found and the queries I’ve run:

SELECT [key], [value], [updated] 
FROM [dbo].[umbracoKeyValue] 
WHERE [key] = 'Umbraco.Web.PublishedCache.NuCache.Serializer';   

key value updated
Umbraco.Web.PublishedCache.NuCache.Serializer MessagePack 2026-05-05 21:02:43.853

I followed the instructions in this link: How to check Umbraco Database Cache Rebuild operation has finished

From what this result gives me, the Cache rebuilding hasn’t been run since the 5th of May (today is the 20th).

I’ve also run this query:

SELECT 
    (SELECT COUNT(*) FROM cmsContentNu) AS CurrentRows,
    (SELECT COUNT(*) * 2 FROM umbracoNode 
     WHERE nodeObjectType IN (
         'C66BA18E-EAF3-4CFF-8A22-41B16D66A972',
         'B796F64C-1F99-4FFB-B886-4BF4BC011A9C'
     )) AS ExpectedRows

Which I got from an AI agent, it tells me this:

CurrentRows ExpectedRows
334 34446

I ran this query maybe 20minutes ago (it’s 08:50 AM now) and then I just got 330 Current Rows, now it’s 334 (again, I don’t really know if the rebuilding of the cache is actually taking place and is just very slow).

So to the issue at hand, how can I tell if the rebuilding of the cache is actually running or not? I’ve searched for NuCache and other related stuff in the logviewer but I get no information. The only “real” indication I have is that it jumped from 330 CurrentRows to 334.

What is the solution here? How can I make sure the Database Cache is rebuilt successfully?

Hi @Pekdon

When you hit Rebuild under the Database Cache and have the Network tab in the Developer Tools open, does it ever complete successfully or does it error? If it errors, what error comes back?

Also, have you got any errors in the log related to NuCache?

Justin

Hi @Pekdon,

Here are some things you can try:

  1. Try this:

  2. Please check this forum link. Paul was having somewhat similar issue:
    Rebuild Database Cache - The request timed out

  3. Also try deleting the local cache files, it’s stored under Temp/NuCache.

  4. At last try truncating the cmsContentNu table.
    Why TRUNCATE and not DELETE?
    A DELETE statement logs every single row removal in the transaction log, which can cause massive log file growth and take a long time on 34,000+ rows. TRUNCATE simply deallocates the data pages, acting instantly and completely clearing any lingering locks.

Hope it helps!

I’ll try setting UsePagedSqlQuery to false, this will force me to recycle the app-pool and restart the site, which I need to contact my client for. It’s for quite a large and national site so this needs to be coordinated a bit. But I will try!

1 Like

I just clicked the rebuild cache button aagain, I’m betting no error in the network tab, all I see is this:

when I search the logviewer for “NuCache” or other nucache related stuff I see nothing, i do however see this:

And now my CurrentRows has jumped to 367, far from 34470. But Im not sure if this is just from visitors going to pages on the site that then ends up in the cache, or if it’s actually the rebuilding of the cache background job that’s still chugging along

Hi @Pekdon

It is most likely still rebuilding the database cache, can you check again shortly? It may be slow if you’re running on production depending on the number of content nodes and spec of the database.

Justin

My sql query i’ve been running to kinda get a feel for how far off I am is this one:

SELECT [key], [value], [updated]
FROM [dbo].[umbracoKeyValue]
WHERE [key] = ‘Umbraco.Web.PublishedCache.NuCache.Serializer’;

SELECT
(SELECT COUNT() FROM cmsContentNu) AS CurrentRows,
(SELECT COUNT() * 2 FROM umbracoNode
WHERE nodeObjectType IN (
‘C66BA18E-EAF3-4CFF-8A22-41B16D66A972’,
‘B796F64C-1F99-4FFB-B886-4BF4BC011A9C’
)) AS ExpectedRows

and my current rows are right now 386, and my expected rows are 34474. when I started it was 330 in my current rows.

And again, I have no idea if the increase from 330→386 is actually the rebuilding of the cache job, or if Umbraco is gradually caching pages/media that visitors access on the site.

I feel very much “in the dark” here :smiley:

Hi @Pekdon

Where is your production site running? Azure or elsewhere?

Justin

It’s runnin on-prem in IIS

Are you able to see from the database whether anything is running that looks like it is rebuilding the NuCache tables? Something like this while a rebuild is supposedly in progress would tell you:

SELECT session_id, status, command, wait_type, blocking_session_id
FROM sys.dm_exec_requests
WHERE session_id <> @@SPID;

If nothing’s hitting cmsContentNu or umbracoNode, the rebuild has died silently. Also worth a quick look at sys.dm_tran_locks in case something’s blocked on umbracoLock.

Also worth checking the site is not recycling mid-rebuild and that the CPU and memory on the server are not running low. App pool recycles mid-rebuild would give you exactly this pattern — small bursts of progress then nothing.

One other thing to try — drop the NuCache logger to Debug in appsettings.json and trigger another rebuild, the silence in the log viewer is itself a clue:

"Serilog": {
  "MinimumLevel": {
    "Override": {
      "Umbraco.Cms.Infrastructure.PublishedCache": "Debug"
    }
  }
}

Appreciate that would require a restart of the site.

Justin

@justin-nevitech I did the xhanges to drop PublishedCache to debug, in my stage environment, i clicked the database cache rebuild button but still saw nothing in the logviewer (the database was rebuilt successfully though)

I’ve yet to hear back from my client yet, so I havn’t taken action that restarts the production evironment yet

Hi @Pekdon

Are you able to pull down a copy of production locally and try rebuilding the database cache locally to see if it works there to rule out a hosting issue?

At least that way you may get more clues if you can turn on additional debug logging wiuthout affecting live.

Justin

@ShekharTarare I did what you asked, it didn’t help. My site is crashing. I can get into the backoffice but when I go to the Published status screen it’s grayed out and I get an error:

Server error: Contact administrator, see log for full details.
*Failed to verify the cache.

(I can’t check the logviewer because it tells me this:)
*

Hi @Pekdon

You will need to look at the logs outside of Umbraco.

I’m assuming this is causing live site issues, so is it worth a restart and try rebuilding the cache again anyway?

Justin

Yes please check the physical text logs, it will tell the exact issue. The log files seem too large that’s why the log viewer is not showing the logs.

Im unsure what to search for, the logfile has over a million lines, but i just searched for the keyword “Panic” and got this:

{

"@t": "2026-05-20T11:48:50.9050406Z",

@mt”: “Panic, exception while loading cache data.”,

@l”: “Fatal”,

@x”: “System.InvalidOperationException: No data for media 1612\r\n at Umbraco.Cms.Infrastructure.PublishedCache.Persistence.NuCacheContentRepository.CreateMediaNodeKit(ContentSourceDto dto, IContentCacheDataSerializer serializer)\r\n at Umbraco.Cms.Infrastructure.PublishedCache.Persistence.NuCacheContentRepository.GetAllMediaSources()+MoveNext()\r\n at Umbraco.Extensions.EnumerableExtensions.InGroupsOf[T](IEnumerable`1 source, Int32 groupSize)+MoveNext()\r\n at Umbraco.Cms.Infrastructure.PublishedCache.ContentStore.SetAllFastSortedLocked(IEnumerable`1 kits, Int32 kitGroupSize, Boolean fromDb)\r\n at Umbraco.Cms.Infrastructure.PublishedCache.PublishedSnapshotService.LoadMediaFromDatabaseLocked(Boolean onStartup)\r\n at Umbraco.Cms.Infrastructure.PublishedCache.PublishedSnapshotService.b__64_4()\r\n at Umbraco.Cms.Infrastructure.PublishedCache.PublishedSnapshotService.LockAndLoadMedia(Func`1 action)\r\n at Umbraco.Cms.Infrastructure.PublishedCache.PublishedSnapshotService.b__64_0()\r\n at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory)\r\n at System.Threading.LazyInitializer.EnsureInitialized[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory)\r\n at Umbraco.Cms.Infrastructure.PublishedCache.PublishedSnapshotService.EnsureCaches()\r\n at Umbraco.Cms.Infrastructure.PublishedCache.PublishedSnapshotService.CreatePublishedSnapshot(String previewToken)\r\n at Umbraco.Cms.Web.Common.UmbracoContext.UmbracoContext.<>c__DisplayClass11_0.<.ctor>b__0()\r\n at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)”,

@tr”: “2e1322ba3596ab5e882981f1e2bfc1eb”,

@sp”: “6586680c23eff15b”,

“SourceContext”: “Umbraco.Cms.Infrastructure.PublishedCache.PublishedSnapshotService”,

“RequestId”: “40000cfc-0006-ff00-b63f-84710c7967bb”,

“RequestPath”: “/”,

“ProcessId”: 8860,

“ProcessName”: “w3wp”,

“ThreadId”: 15,

“ApplicationId”: “6e8db0fd0aebcbe213eabc9d3fc38e061aecb71b”,

“MachineName”: “FOS-APP01-PROD”,

“Log4NetLevel”: “FATAL”,

“HttpRequestId”: “d4850bea-28d2-4f0c-af64-0f4a3a60f382”,

“HttpRequestNumber”: 2,

“HttpSessionId”: “0”

}

my AI agent is telling me some data, somewhere is corrupt and is causing DocumentRepository.MapDtosToContent to throw exceptions

If you go into the media library and amend the URL to load 1612, does it give you any errors and/or load the media?

https://www.yourdomain.com/umbraco#/media/media/edit/1612

I would start there if it thinks something is corrupt or wrong…

Also, are you able to pull down the site and database locally as you could then run the Umbraco code to possibly get more details…

im working on grabbing the database backup!

i went to the media/edit/1612, it’s just a nromal folder in the media library and didn’t give me any errors

My AI agent tells me that we need the cmsContentNu cache to be rebuilt and that’s what’s causing the issues.