/rest/spenttxouts/<hash> reads the undo file for every block above genesis. For a block that was stored but never connected (a side branch) or whose undo data was pruned, there is no undo position, so OpenUndoFile() fails and ReadBlockUndo() writes OpenUndoFile failed for FlatFilePos(nFile=-1, nPos=0) to debug.log with LogError. The request itself already returns 404, but each unauthenticated request for such a block adds an [error] line that looks like disk corruption.
This checks CheckBlockDataAvailability() for BLOCK_HAVE_UNDO before reading, so nothing is logged. Pruning clears BLOCK_HAVE_UNDO, so pruned blocks are covered too. The response is unchanged.
The new check at the end of interface_rest.py requests a stale block and fails on master because of the logged error.