500 Error when student tried to load course

I am running a recent version of Open edX via Tutor. When a standard enrolled student tries to access a course via ://mydomain.com, the Learning MFE throws "There was an error loading the course."Course owners/admins can load course without a problem. The logs show:
AttributeError: Field self_paced does not exist on GET /api/course_home/outline/...I have already verified course start dates are not in the future - and - course end dates are many years in the future. course modes (audit) exist in Django admin, and running generate_course_blocks --force_update did not clear it. My debugging seems to indicate that the issue is related to has_access: false triggering an unhandled exception in the blocks transformer API (but I am not confident about that). I have enrolled the test student in the instructor → enrollment area without problem, however, when I go to /admin and look at student enrollments, the student was not listed there, so I have added the enrollment recorded explicitly there as well (which I don’t think I should have had to). I have tried this with “Invitation Only” set to both “true” (which I want) and “false” which I thought I’d try. I have also completely removed any email registration process which requires the student to accept the enrollment - so - student has an “active” enrollment. Every time I retest the “test student” I run incognito (CRTL-SHIFT-N) to ensure there’s no cacheing issues interfering with my changes. Any advice on how to resolve or patch this?

Hi @lesking, I think this is Bug: Course Blocks API 500s for an enrolled learner when the course start date is in the future · Issue #39115 · openedx/openedx-platform · GitHub, which is still open. When the learner fails the course access check, the Blocks API reaches HiddenContentTransformer with a course block that has no collected self_paced field. It crashes with a 500 instead of returning a clean “no access” response. Staff skip that transformer, which is why admins can load the course.

Your has_access: false finding is the useful clue: the crash is a side effect, not the real problem. To see why access is denied, log in as the test student and open:

https://<lms>/api/course_home/course_metadata/<course_id>

Hi @Ahmed_Khalid - thanks for the quick response. Appreciated. The only wording in the 39115 issue which makes me want to confirm this is what I’m banging up against is the “course start date is in the future”. My course start date is definitely in the past. Back in 2025 to be specific. This course was running perfectly fine in an older version of Open edX - but - with my new installation and import of courses/libraries, this appears to be a regression. If you still think this is the issue, I’ll wait for the fix for this issue and apply it. Just wanted to share some additional perspective to make sure I’m not waiting on the wrong bug fix.

Hello, I guess my other question is whether there is an established workaround for this issue. The only workaround I can think of is to make my students course owners for the duration of the course - then - change them back to “normal” students. Not a particularly wise approach, but given everything else I’ve tried, I cannot think of any other approach. Reality is I am delaying my courses day-by-day right now which is also quite painful. Any suggestions are welcome.

The start date in #39115 is only one way to hit this. The crash happens whenever something removes the course block itself from a learner’s view of the course. A future start date is one cause; group or partition restrictions on the course block, or staff-only visibility on it, are others. So even with your start date in 2025, it’s very likely the same bug.

I’ve opened a fix: fix: don't crash HiddenContentTransformer when the course block was removed by ahmed-arb · Pull Request #39167 · openedx/openedx-platform · GitHub. It stops the 500, but your students would then get an empty course instead of an error. So the real fix is finding what’s removing the course block for them, which is most likely something that came in with the import.

I’d avoid making students course owners. That gives them Studio and instructor dashboard access. Instead, this shows which check is removing the course block for your test student. Run it in tutor local run lms ./manage.py lms shell:

 from django.contrib.auth import get_user_model
 from opaque_keys.edx.keys import CourseKey
 from xmodule.modulestore.django import modulestore
 from lms.djangoapps.course_blocks.api import get_course_blocks, get_course_block_access_transformers
 from openedx.core.djangoapps.content.block_structure.transformers import BlockStructureTransformers

 user = get_user_model().objects.get(username="<learner>")
 root = modulestore().make_course_usage_key(CourseKey.from_string("<course_id>"))
 for t in get_course_block_access_transformers(user):
     if type(t).__name__ == "DateOverrideTransformer":
         continue
     blocks = get_course_blocks(user, root, BlockStructureTransformers([t]))
     print(type(t).__name__, root in blocks)

The line that prints False is your cause:

  • UserPartitionTransformer: the course block has a group restriction the student isn’t in. This could be a content group, cohort or enrollment track, possibly carried over by the import.
  • VisibilityTransformer: the course block is marked visible to staff only.
  • StartDateTransformer: the start date the LMS has stored for the course differs from what Studio shows.

If you post the output, I can help narrow it down.