ERROR Should have exactly one hook registered

Kolibri 0.12.8
Ubuntu 18.04
Chrome and Firefox

Had a working instance…using content from a USB key. Worked fine for weeks…

But now, when I do a request, or simply http://127.0.0.1:8080, i get Server Error (500)

I am starting server in foreground, here is output:

kolibri start --foreground
INFO Running Kolibri with the following settings: kolibri.deployment.default.settings.base
INFO Sqlite database Vacuum finished.
INFO Running ‘kolibri start’ in foreground…
INFO Kolibri running on:

http://127.0.0.1:8080/
http://172.16.240.1:8080/
http://192.168.200.1:8080/
http://192.168.43.110:8080/

INFO Attempting a ping.
INFO Started new JOBCHECKER thread ID#e2b77da9a3f74fe7ada447f303ed0bc4
INFO Updating num_coach_content on existing channels
INFO Sqlite database Vacuum finished.
INFO Next Vacuum at 3AM local server time (in 761.7666666666667 minutes).
INFO Starting Kolibri 0.12.8
INFO Ping succeeded! (response: {‘id’: 620574, ‘messages’: []})
WARNING Ping failed (could not connect). Trying again in 15.0 minutes.
INFO ENGINE Bus STARTING
INFO ENGINE Serving on http://0.0.0.0:8080
INFO ENGINE Bus STARTED
ERROR Should have exactly one hook registered.

stack trace:
ERROR 2020-02-18 18:25:33,994 hooks Should have exactly one hook registered.
ERROR 2020-02-18 18:25:34,008 exception Internal Server Error: /en/user/
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/kolibri/dist/django/core/handlers/exception.py”,
line 41, in inner
response = get_response(request)
File “/usr/lib/python3/dist-packages/kolibri/dist/django/core/handlers/base.py”, line
187, in _get_response
response = self.process_exception_by_middleware(e, request)
File “/usr/lib/python3/dist-packages/kolibri/dist/django/core/handlers/base.py”, line
185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/usr/lib/python3/dist-packages/kolibri/dist/django/views/generic/base.py”, line
68, in view
return self.dispatch(request, *args, **kwargs)
File “/usr/lib/python3/dist-packages/kolibri/dist/django/utils/decorators.py”, line 67
, in _wrapper
return bound_func(*args, **kwargs)
File “/usr/lib/python3/dist-packages/kolibri/dist/django/views/decorators/http.py”, li
ne 88, in inner
res_etag = etag_func(request, *args, **kwargs) if etag_func else None
File “/usr/lib/python3/dist-packages/kolibri/core/decorators.py”, line 325, in calcula
te_spa_etag
+ str(ThemeHook().cacheKey).encode(“utf-8”)
File “/usr/lib/python3/dist-packages/kolibri/plugins/hooks.py”, line 220, in inner
return func(instance, *args, **kwargs)
File “/usr/lib/python3/dist-packages/kolibri/core/theme_hook.py”, line 129, in cacheKe
y
theme = list(self.registered_hooks)[0].theme
IndexError: list index out of range

Hi @jeffg -

This error seems to indicate that something has changed in your configuration, possibly related to plugins. Have you or anyone else possibly run any kolibri manage ... commands?

Would you mind posting the contents of the file ~/.kolibri/kolibri_settings.json?

Thank you

settings.json:

{
“AUTO_SEARCH_PLUGINS”: [],
“DISABLED_APPS”: [],
“FIRST_RUN”: false,
“INSTALLED_APPS”: [
“kolibri.plugins.learn”,
“kolibri.plugins.media_player”,
“kolibri.plugins.document_pdf_render”,
“kolibri.plugins.style_guide”,
“kolibri.plugins.coach”,
“kolibri_exercise_perseus_plugin”,
“kolibri.plugins.html5_app_renderer”,
“kolibri.plugins.user”,
“kolibri.plugins.setup_wizard”
]
}

I only starting playing around with manage commands after this problem surfaced. I tried manage listchannels to see if it still recognized my content, and vacuumsqlite just in case (though thats done on start)…

Devon, thanks for the clue. I compared this file to the one on my RPI (still running) and discovered 4 lines different:
“kolibri.plugins.default_theme”,
“kolibri.plugins.style_guide”,
“kolibri.plugins.facility_management”,
“kolibri.plugins.device_management”
after adding them, the problem went away. The question is how they got removed…

Thanks - glad that resolved it.

My guess is that if you were having problems before, it was actually giving a different error. Then some manage command change caused a new issue.

If you’d like, you can look back at your logs from when the problems initially started and check for errors during that time.