Server fails to allow login

What is the problem?
I can't get the OctoPrint webpage to display. It says "Loading failed" and there is a 500 response to the login call on the debugging network tab in Chrome. It was all working normally, there was no update or plugin installation. We might have had a power failure, so maybe something got corrupted.

What did you already try to solve it?
I tried starting in Safe mode - no change
I tried an Incognito window - no change
I rebooted the Pi - no change.
I looked at the config.yaml file - looks normal, not corrupted.

Logs (octoprint.log)

2020-03-26 01:23:15,877 - octoprint.startup - INFO - ******************************************************************************
2020-03-26 01:23:15,879 - octoprint.startup - INFO - Starting OctoPrint 1.4.0
2020-03-26 01:23:15,880 - octoprint.startup - INFO - Starting in SAFE MODE. Third party plugins will be disabled!
2020-03-26 01:23:15,880 - octoprint.startup - INFO - Reason for safe mode: setting in config.yaml
2020-03-26 01:23:15,882 - octoprint.startup - INFO - ******************************************************************************
2020-03-26 01:23:16,600 - octoprint.startup - INFO - We don't appear to be online, not fetching plugin blacklist
2020-03-26 01:23:16,674 - octoprint.plugin.core - INFO - Loading plugins from /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins, /home/pi/.octoprint/plugins and installed plugin packages...
2020-03-26 01:23:18,549 - octoprint.plugin.core - INFO - Found 20 plugin(s) providing 15 mixin implementations, 27 hook handlers
2020-03-26 01:23:18,819 - octoprint.server.heartbeat - INFO - Starting server heartbeat, 900.0s interval
2020-03-26 01:23:18,972 - octoprint.server - INFO - Intermediary server started
2020-03-26 01:23:18,975 - octoprint.plugin.core - INFO - Loading plugins from /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins, /home/pi/.octoprint/plugins and installed plugin packages...
2020-03-26 01:23:19,154 - octoprint.plugin.core - INFO - Found 20 plugin(s) providing 15 mixin implementations, 27 hook handlers
2020-03-26 01:23:19,202 - octoprint.filemanager.storage - INFO - Initializing the file metadata for /home/pi/.octoprint/uploads...
2020-03-26 01:23:19,795 - octoprint.filemanager.storage - INFO - ... file metadata for /home/pi/.octoprint/uploads initialized successfully.
2020-03-26 01:23:19,799 - octoprint.server - INFO - Added new permission from plugin action_command_prompt: PLUGIN_ACTION_COMMAND_PROMPT_INTERACT (needs: u"Need(method='role', value=u'plugin_action_command_prompt_interact')")
2020-03-26 01:23:19,801 - octoprint.server - INFO - Added new permission from plugin announcements: PLUGIN_ANNOUNCEMENTS_READ (needs: u"Need(method='role', value=u'plugin_announcements_read')")
2020-03-26 01:23:19,802 - octoprint.server - INFO - Added new permission from plugin announcements: PLUGIN_ANNOUNCEMENTS_MANAGE (needs: u"Need(method='role', value=u'plugin_announcements_manage'), Need(method='role', value=u'plugin_announcements_read')")
2020-03-26 01:23:19,804 - octoprint.server - INFO - Added new permission from plugin appkeys: PLUGIN_APPKEYS_ADMIN (needs: u"Need(method='role', value=u'plugin_appkeys_admin')")
2020-03-26 01:23:19,806 - octoprint.server - INFO - Added new permission from plugin backup: PLUGIN_BACKUP_ACCESS (needs: u"Need(method='role', value=u'plugin_backup_access')")
2020-03-26 01:23:19,807 - octoprint.server - INFO - Added new permission from plugin logging: PLUGIN_LOGGING_MANAGE (needs: u"Need(method='role', value=u'plugin_logging_manage')")
2020-03-26 01:23:19,809 - octoprint.server - INFO - Added new permission from plugin pi_support: PLUGIN_PI_SUPPORT_STATUS (needs: u"Need(method='role', value=u'plugin_pi_support_check')")
2020-03-26 01:23:19,810 - octoprint.server - INFO - Added new permission from plugin pluginmanager: PLUGIN_PLUGINMANAGER_MANAGE (needs: u"Need(method='role', value=u'plugin_pluginmanager_manage')")
2020-03-26 01:23:19,811 - octoprint.server - INFO - Added new permission from plugin pluginmanager: PLUGIN_PLUGINMANAGER_INSTALL (needs: u"Need(method='role', value=u'plugin_pluginmanager_install'), Need(method='role', value=u'plugin_pluginmanager_manage')")
2020-03-26 01:23:19,812 - octoprint.server - INFO - Added new permission from plugin printer_safety_check: PLUGIN_PRINTER_SAFETY_CHECK_DISPLAY (needs: u"Need(method='role', value=u'plugin_printer_safety_check_display')")
2020-03-26 01:23:19,814 - octoprint.server - INFO - Added new permission from plugin softwareupdate: PLUGIN_SOFTWAREUPDATE_CHECK (needs: u"Need(method='role', value=u'plugin_softwareupdate_check')")
2020-03-26 01:23:19,815 - octoprint.server - INFO - Added new permission from plugin softwareupdate: PLUGIN_SOFTWAREUPDATE_UPDATE (needs: u"Need(method='role', value=u'plugin_softwareupdate_update')")
2020-03-26 01:23:19,974 - octoprint.plugins.softwareupdate - INFO - Loaded version cache from disk
2020-03-26 01:23:21,609 - octoprint.util.pip - INFO - Using "/home/pi/oprint/bin/python2 -m pip" as command to invoke pip
2020-03-26 01:23:22,733 - octoprint.util.pip - INFO - Version of pip is 19.3.1
2020-03-26 01:23:22,735 - octoprint.util.pip - INFO - pip installs to /home/pi/oprint/lib/python2.7/site-packages (writable -> yes), --user flag needed -> no, virtual env -> yes
2020-03-26 01:23:22,737 - octoprint.util.pip - INFO - ==> pip ok -> yes
2020-03-26 01:23:22,742 - octoprint.plugin.core - INFO - Initialized 15 plugin implementation(s)
2020-03-26 01:23:22,754 - octoprint.plugin.core - INFO - 20 plugin(s) registered with the system:
|  Action Command Prompt Support (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/action_command_prompt
|  Announcement Plugin (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/announcements
|  Anonymous Usage Tracking (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/tracking
|  Application Keys Plugin (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/appkeys
|  Backup & Restore (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/backup
|  Core Wizard (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/corewizard
|  Discovery (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/discovery
|  Error Tracking (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/errortracking
|  Logging (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/logging
|  Login UI (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/loginui
| !Octolapse (0.3.4) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_octolapse
|  Pi Support Plugin (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/pi_support
|  Plugin Manager (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/pluginmanager
|  Printer Safety Check (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/printer_safety_check
| !Prusa Leveling Guide (1.0.7) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_PrusaLevelingGuide
| !Resource Monitor (0.2.2) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_resource_monitor
|  Software Update (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/softwareupdate
| !Themeify (1.2.0) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_themeify
| !TouchUI (0.3.14) = /home/pi/oprint/local/lib/python2.7/site-packages/octoprint_touchui
|  Virtual Printer (bundled) = /home/pi/oprint/lib/python2.7/site-packages/octoprint/plugins/virtual_printer
Prefix legend: ! = disabled, # = blacklisted, * = incompatible
2020-03-26 01:23:22,771 - octoprint.environment - INFO - Detected environment is Python 2.7.16 under Linux (linux2). Details:
|  hardware:
|      cores: 4
|      freq: 1400.0
|      ram: 917012480
|  os:
|      id: linux
|      platform: linux2
|  plugins:
|      pi_support:
|          model: Raspberry Pi 3 Model B Plus Rev 1.3
|          octopi_version: 0.17.0
|  python:
|      pip: 19.3.1
|      version: 2.7.16
|      virtualenv: /home/pi/oprint
2020-03-26 01:23:22,782 - octoprint.server - INFO - Reset webasset folder /home/pi/.octoprint/generated/webassets...
2020-03-26 01:23:22,807 - octoprint.server - INFO - Reset webasset folder /home/pi/.octoprint/generated/.webassets-cache...
2020-03-26 01:23:23,787 - octoprint.server - INFO - Shutting down intermediary server...
2020-03-26 01:23:23,791 - octoprint.server - INFO - Intermediary server shut down
2020-03-26 01:23:23,796 - octoprint.events - INFO - Processing startup event, this is our first event
2020-03-26 01:23:23,799 - octoprint.events - INFO - Adding 0 events to queue that were held back before startup event
2020-03-26 01:23:23,802 - octoprint.filemanager - INFO - Adding backlog items from all storage types to analysis queue...
2020-03-26 01:23:23,820 - octoprint.server.util.watchdog - INFO - Running initial scan on watched folder...
2020-03-26 01:23:23,827 - octoprint.filemanager - INFO - Added 0 items from storage type "local" to analysis queue
2020-03-26 01:23:23,828 - octoprint.server.util.watchdog - INFO - ... initial scan done.
2020-03-26 01:23:23,844 - octoprint.plugins.discovery - INFO - Registered 'OctoPrint instance on octopi' for _http._tcp
2020-03-26 01:23:23,860 - octoprint.plugins.discovery - INFO - Registered 'OctoPrint instance on octopi' for _octoprint._tcp
2020-03-26 01:23:23,879 - octoprint.plugins.discovery - INFO - Registered OctoPrint instance on octopi for SSDP
2020-03-26 01:23:23,901 - octoprint.server - INFO - Listening on http://127.0.0.1:5000
2020-03-26 01:23:23,902 - octoprint.server - INFO - Server started successfully in safe mode as requested from config, removing flag
2020-03-26 01:23:24,134 - octoprint.plugins.pluginmanager - INFO - Loaded plugin repository data from disk, was still valid
2020-03-26 01:23:25,611 - octoprint.util.pip - INFO - Using "/home/pi/oprint/bin/python2 -m pip" as command to invoke pip
2020-03-26 01:23:25,675 - octoprint.util.pip - INFO - pip installs to /home/pi/oprint/lib/python2.7/site-packages (writable -> yes), --user flag needed -> no, virtual env -> yes
2020-03-26 01:23:25,678 - octoprint.util.pip - INFO - ==> pip ok -> yes
2020-03-26 01:23:25,702 - octoprint.util.connectivity_checker - INFO - Connectivity changed from offline to online
2020-03-26 01:23:25,785 - octoprint.plugins.pluginmanager - INFO - Loaded plugin repository data from disk, was still valid
2020-03-26 01:23:27,120 - octoprint.plugins.pluginmanager - INFO - Loaded notice data from disk, was still valid
2020-03-26 01:23:27,376 - octoprint.plugins.pluginmanager - INFO - Loaded notice data from disk, was still valid
2020-03-26 01:23:27,492 - octoprint.server.preemptive_cache - INFO - Preemptively caching / (ui _default) for {'query_string': 'l10n=en', 'path': '/', 'base_url': 'http://octopi.local/'}
2020-03-26 01:23:27,554 - tornado.access - WARNING - 404 POST /api/plugin/zbolt_octoscreen (127.0.0.1) 38.58ms
2020-03-26 01:23:27,575 - octoprint.server.util.sockjs - INFO - New connection from client: ::ffff:192.168.86.249
2020-03-26 01:23:27,654 - tornado.access - WARNING - 404 POST /api/plugin/zbolt_octoscreen (127.0.0.1) 15.32ms
2020-03-26 01:23:27,915 - tornado.access - ERROR - 500 POST /api/login (::ffff:192.168.86.249) 255.21ms
2020-03-26 01:23:57,145 - tornado.access - ERROR - 500 POST /api/login (::ffff:192.168.86.249) 19.47ms

Additional information about your setup (OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible)
Raspberry PI 3+,OctoPi 0.17.0, Chrome, Windows 10.

Chrome Network Tab:

|octopi.local|200|document|Other|401 KB|2.27 s|
|packed_libs.css?ec88168c|200|stylesheet|(index)|165 KB|54 ms|
|packed_core.css?b577b523|200|stylesheet|(index)|99.3 KB|59 ms|
|less.min.js|200|script|(index)|141 KB|74 ms|
|tentacle-20x20.png|200|png|(index)|1.1 KB|13 ms|
|fontawesome-webfont.woff2?v=4.7.0|200|font|(index)|75.8 KB|16 ms|
|packed_libs.js?3339d949|200|script|(index)|1.1 MB|76 ms|
|packed_client.js?313d9a0c|200|script|(index)|76.3 KB|43 ms|
|packed_core.js?3514a079|200|script|(index)|706 KB|85 ms|
|messages.js|200|script|(index)|442 B|82 ms|
|mask-theme.svg|200|svg+xml|packed_core.js?3514a079:1119|2.4 KB|23 ms|
|info?t=1585199263307|200|xhr|packed_libs.js?3339d949:24031|495 B|24 ms|
|websocket|101|websocket|packed_libs.js?3339d949:24109|0 B|Pending|
|login|500|xhr|packed_libs.js?3339d949:9601|483 B|98 ms|

Response text (in HTML doc):

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

Request call stack (Initiator tab)

send
ajax
OctoPrintClient.ajax
OctoPrintClient.ajaxWithData
OctoPrintClient.post
OctoPrintClient.postJson
OctoPrintBrowserClient.passiveLogin
LoginStateViewModel.self.requestData
onServerConnect
(anonymous)
fire
fireWith