Projects with Raytracing enabled crash instantly on build.

I was trying to build my main project to a standalone window. Everything works fine in the editor, but trying to build to standalone opens a black window, loads for a moment, and then quits and sometimes gives me an error message, although it’s seemingly a different error every time. (seen below)
I thought maybe it was something in my project, so I tried with a blank project (with raytracing enabled). Didn’t edit anything, just opened a blank project, saved it, and tried building. Same crashes. THEN I tried it with a blank project without raytracing enabled. It built fine! What’s going wrong here? Sometimes it seems like a GPU driver error, sometimes it seems like a memory error. It isn’t consistent. And again, my project works fine in the editor.
I don’t get crashes when playing any other raytraced games like Cyberpunk, Alan Wake 2, etc. This is only happening with Unreal engine. I’m running on a 4090, with an i9-13900k and 64GB of ram so my PC can definitely handle it. Unreal version 5.3.2, graphics drivers all updated, system rebooted several times, no background programs. I’ve tried everything!