Issue with saving/loading AudioProcessorValueTreeState state to XML file

I’ve been working on a preset loading/saving feature for a synth plugin, and everything gets set up fine i.e currentWorkingDirectory is set to the right folder, a “blank patch” file gets created w the state info as XML if it doesn’t already exist, the APVTS gets its state from the selected file. The issue comes when trying to create a new file for the XML programmatically; this particular line always throws an error:
tree.state = juce::ValueTree("newPatch"); where tree is an APVTS object. Trying to use auto state = tree.copyState(); causes the same issue. In the constructor for the plugin processor I have
tree.state = juce::ValueTree("defaultParams");
auto defaultValueTreeState = tree.copyState();
Which causes no issues. Does anyone have experience with this or some idea of what I’ve done wrong? Thanks

Could you please share what the error actually is? It could poitentially have nothing to do with this line.

Specifically, the debugger is triggering on this line in the ‘juce_ReferenceCountedObject.h’ file:
bool operator!= (const ReferenceCountedObjectPtr& other) const noexcept { return referencedObject != other.get(); }
where ‘other’ points to the ValueTree object created by
tree.state = juce::ValueTree("newPatch");
I guess the issue is with comparing the tree.state object and the ValueTree("newPatch") which, I assume, means that one of those two is somehow not valid or accessible, but I can’t tell which one or why.