I just hit this exact same error trying to upgrade from 3.1.0.beta2 to 3.1.0.beta3. This happened in my non-production box that I use to “practice” upgrades before performing them on the production box.
In my case, the forum was down after I encountered the error.
Removing the discourse-data-explorer plugin line from my app.yml and rebuilding worked around the problem.
Many thanks to @Ed_S for saving me tons of time with this helpful post!