iTunes: The song could not be used because the original file could not be found. Would you like to locate it? I've deleted cached Apple Music files as I've needed to free up some space on my Mac.

Now whenever I try to play a previously cached (and deleted) song from Apple Music, I get the following error:



When I click Cancel, it starts playing normally (starts streaming as if it wasn't cached before), though I get the same error for every single song that have been previously cached.

How can I make iTunes understand that none of those songs are there on disk and need to be downloaded on demand?
Have you tried consolidating the files? Go to "File" -> "Library" -> "Organize Library" -> "Consolidate files". Afterwards iTunes should know that none of those songs are on your disk.