JUCE Assertion failure in juce_AudioProcessorValueTreeState.cpp:315

There is a lot of information in this thread, when the new method was introduced:

TL;DR:

You can either:

// members
juce::UndoManager undo;
juce::AudioProcessorValueTreeState state { *this, &undo };
// constructor
state.createAndAddParameter (...);
state.state = juce::ValueTree("Parameters");

or:

// members
juce::UndoManager undo;
juce::AudioProcessorValueTreeState state;
// free function
juce::AudioProcessorValueTreeState::ParameterLayout createParameters()
{
    juce::AudioProcessorValueTreeState::ParameterLayout layout;
    layout.add (std::make_unique<juce::AudioParameterFloat>(...);
    return layout;
}
// constructor:
MyProcessor::MyProcessor()
  : state (*this, &undo, "Parameters", createParameters())
{}

In the second version you cannot add parameters after the APVTS constructor, hence the jassert