Invalid texture after it's recreation due to resize event

The question is: why a texture becomes invalid for a SDL_SetRenderTarget? I have created the texture with the exact same code in the constructor and in the on resize event, yet after the resize event it is no longer valid. From my understanding it’s as if it lost its SDL_TEXTUREACCESS_TARGET flag. It works properly up till the point I destroy the target texture and recreate it when a resize event occurs. I would love if someone could brainstorm with me why this is happening… Please interrogate me as it is eating at me.

I’d also like to add that I can’t reproduce this failure 100% of the time, so there is some random factor. Sometimes it happens after the first maximization of the window, sometimes after the 10th.