I have simular issues. I've also got the error after upgrading to SF 5.1.
But now all my Dynamic Content parts are gone.
Under Content all created dynamic modules are missing and also the link to module builder in de settings pane is gone.
Database usage for the config file is not an option here, and the other suggestion also didn't work.
Hope someone can help