Changing Scene Breaks Custom Render Feature

When I switch to a different scene, my custom render feature no longer works and the error
“Attempting to get Camera relative temporary RenderTexture (width || height <= 0) via a CommandBuffer Cloud Render Feature in a Sriptable Render Pipeline.” is thrown before
“Trying to get a relatively sized RenderBuffer without an active camera.”
is thrown repeatedly every frame.
I can’t tell what is causing this as there definitely is a main camera. I know that commenting out commandbuffer.GetTemporaryRT will stop the error (but cause the feature to stop working)
I’m using Unity version 2021.3.16f1 and URP 12.

Nevermind, I fixed it. Putting in commandBuffer.Clear() (commandBuffer is name of CommanBuffer variable) after getting and executing cleared it up.