I had this problem several times in the past. Check your graphics card, remove the graphics card and reinstall it 100% correctly. It can also help to carefully clean the Pcie Slot with a fine brush. Make sure that the graphics card is really fully seated in the Pcie slot. The pcie connection of the graphics card should not be touched with your fingers if possible. It is best to clean it with a cloth soaked in alcohol or acetone. Incidentally, gasoline lighter is also suitable. I suspect that the problem may arise from the fact that today's mid-range and high-end graphics cards are relatively heavy and continue to sag over time. This could cause problems with the connection to the PCIE slot. If the error disappears when you reinstall the graphics card, this would be a clear indicator. In this case, a graphics card holder would help, which you can obtain from Amazon, for example.
Before that, however, I would suggest reinstalling the graphics driver by uninstalling it using the DDU tool in windows safe mode.
Removing all C ++ programs has also fixed the error. To do this, you should then download x64 and x86 from Microsoft and install the new ones again after uninstalling the old C ++ versions. Then have Apex Legends repaired via Origin or Steam.
Overclocking the Bclk can also cause this error to occur.
Greetings