Troubleshooting “source code string cannot contain null bytes” - Notification configuration

Troubleshooting “source code string cannot contain null bytes” - Notification configuration

This failure can occur, if there was a storage-related issue (e.g., unavailability of the storage backend, or a read-only file system).

LAST TESTED ON CHECKMK 2.3.0P1

Table of Contents

Problem

Instead of the Notification configuration page, only this error message is shown:

Error message

Internal error: source code string cannot contain null bytes

An internal error occurred while processing your request. You can report this issue to the Checkmk team to help fix this issue. Please open the crash report page and use the form for reporting the problem.


In the crash report, you can find a traceback like this:

  File "/omd/sites/mysite/lib/python3/cmk/gui/wsgi/applications/checkmk.py", line 183, in _process_request
    resp = page_handler()
  File "/omd/sites/mysite/lib/python3/cmk/gui/wsgi/applications/utils.py", line 107, in _call_auth
    func()
  File "/omd/sites/mysite/lib/python3/cmk/gui/pages.py", line 187, in wrapper
    return hc().handle_page()
  File "/omd/sites/mysite/lib/python3/cmk/gui/pages.py", line 51, in handle_page
    self.page()
  File "/omd/sites/mysite/lib/python3/cmk/gui/pages.py", line 146, in <lambda>
    "page": lambda self: self._wrapped_callable[0](),
  File "/omd/sites/mysite/lib/python3/cmk/gui/wato/page_handler.py", line 100, in page_handler
    _wato_page_handler(current_mode, mode_instance)
  File "/omd/sites/mysite/lib/python3/cmk/gui/wato/page_handler.py", line 156, in _wato_page_handler
    mode.handle_page()
  File "/omd/sites/mysite/lib/python3/cmk/gui/plugins/wato/utils/base_modes.py", line 177, in handle_page
    return self.page()
  File "/omd/sites/mysite/lib/python3/cmk/gui/wato/pages/notifications.py", line 660, in page
    self._show_notification_backlog()
  File "/omd/sites/mysite/lib/python3/cmk/gui/wato/pages/notifications.py", line 732, in _show_notification_backlog
    backlog = store.load_object_from_file(
  File "/omd/sites/mysite/lib/python3/cmk/utils/store/__init__.py", line 186, in load_object_from_file
    return ObjectStore(Path(path), serializer=DimSerializer()).read_obj(default=default)
  File "/omd/sites/mysite/lib/python3/cmk/utils/store/_file.py", line 136, in read_obj
    return self._serializer.deserialize(raw) if raw else default
  File "/omd/sites/mysite/lib/python3/cmk/utils/store/_file.py", line 75, in deserialize
    return literal_eval(raw.decode("utf-8"))
  File "/omd/sites/mysite/lib/python3.11/ast.py", line 64, in literal_eval
    node_or_string = parse(node_or_string.lstrip(" \t"), mode='eval')
  File "/omd/sites/mysite/lib/python3.11/ast.py", line 50, in parse
    return compile(source, filename, mode, flags,


Solution

  1. Log into your central Checkmk site as the site user and navigate to the notify directory:

    OMD[mysite]: cd $OMD_ROOT/var/check_mk/notify
  2. Empty the backlog.mk file to get rid of a corruption in the file (this will potentially delete unsent notifications!) :

    OMD[mysite]:$OMD_ROOT/var/check_mk/notify :> backlog.mk