Logs full of stacktraces for "normal" errors?

There are varying opinions on what and how to log things, and there are definitely people who think it’s fine to log “normal” situations as errors, with full stack traces in the logs. This can cause issues, however, with very complicated projects like openedx!

I am trying to set up openedx in a non-standard way, which means I am extremely reliant on things like errors appearing in logs to know whether I am doing stuff right or wrong.

I am trying to use the management commands to import generated OLX courses, and turned to the logs to see what was going on. Alas, I saw many dozens of errors in the cms-worker logs :frowning: . In order to debug fully, I installed a new platform from a completely fresh, pure tutor installation, created a user, then logged in to create a course in the interface. Upon creating a course in the UI, I again saw many dozens of full stacktraces in the cms-worker logs.

An example is:

cms-worker-1   | [2025-10-22 02:58:52,976: ERROR/ForkPoolWorker-7] Task openedx.core.djangoapps.bookmarks.tasks.update_xblocks_cache[23f71267-13b
d-4141-b698-3b5f62e7cb4c] raised unexpected: AttributeError("'NoneType' object has no attribute 'has_children'")
cms-worker-1   | Traceback (most recent call last):
cms-worker-1   |   File "/openedx/venv/lib/python3.11/site-packages/celery/app/trace.py", line 453, in trace_task
cms-worker-1   |     R = retval = fun(*args, **kwargs)
cms-worker-1   |                  ^^^^^^^^^^^^^^^^^^^^
cms-worker-1   |   File "/openedx/venv/lib/python3.11/site-packages/celery/app/trace.py", line 736, in __protected_call__
cms-worker-1   |     return self.run(*args, **kwargs)
cms-worker-1   |            ^^^^^^^^^^^^^^^^^^^^^^^^^
cms-worker-1   |   File "/openedx/venv/lib/python3.11/site-packages/edx_django_utils/monitoring/internal/code_owner/utils.py", line 195, in new_f
unction
cms-worker-1   |     return wrapped_function(*args, **kwargs)
cms-worker-1   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-worker-1   |   File "/openedx/edx-platform/openedx/core/djangoapps/bookmarks/tasks.py", line 163, in update_xblocks_cache
cms-worker-1   |     _update_xblocks_cache(course_key)
cms-worker-1   |   File "/openedx/edx-platform/openedx/core/djangoapps/bookmarks/tasks.py", line 115, in _update_xblocks_cache
cms-worker-1   |     blocks_data = _calculate_course_xblocks_data(course_key)
cms-worker-1   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-worker-1   |   File "/openedx/edx-platform/openedx/core/djangoapps/bookmarks/tasks.py", line 35, in _calculate_course_xblocks_data
cms-worker-1   |     children = current_block.get_children() if current_block.has_children else []
cms-worker-1   |                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^
cms-worker-1   | AttributeError: 'NoneType' object has no attribute 'has_children'

Is this sort of error expected/desired in the FOSS tutor/openedx version? Are they historical? If so, is there any simple way to differentiate between these expected errors and unexpected errors?

If not, would it be worth creating a GH issue to try and reduce the noise?

Thanks!

  • I agree that we don’t want unhelpful noise in general.
  • I would not necessarily add a big generic ticket about reducing noise, but targeted tickets to fix issues like this sounds reasonable, especially if it is specifically getting in your way.
  • I do see this in the 2U logs, so this is an active issue. It seems reasonable that someone could look into this and make it nicer, whether it is a real error that could do with a more helpful log message, or if it should be a warning, or info, or nothing at all.

Thank you.

1 Like

I believe @kmccormick is our resident warning squasher/expert, perhaps Kyle may be able to share some insight?

1 Like

No, not at all :slight_smile: A clean log is a good log. Ideally, the only instances of “ERROR” would be when there’s actually an error for you to pay attention to. It’s a challenge for us to maintain this state, but it’s worth striving for.

Please feel free to open edx-platform issues for any spurious error or warning you notice @antonofthewoods. I can’t guarantee we’ll get to all of them, but it will be good to have them recorded anyway. You can add the help wanted label to encourage volunteer contributors to pick up the issues, and of course you are welcome to tackle any of them yourself. Feel free to tag me on GitHub if you need pointers / sanity checks.

(Trivia: My proud “Warning Squasher” badge is just a participation award from the last time we made a concerted effort to clean up the logs.)

2 Likes