Skip to content

Video handlers answer 500 on a stock install: yt_video_metadata with no API key, transcript handler when the edx-val file is missing #39211

Open

Description

@bmtcril

On a stock install, every video unit makes two requests that answer 500 where a 4xx (or an empty payload) is the right answer. Playback still works, but each video page logs two server errors and the browser console shows "Unable to get youtube video metadata" and "ERROR while fetching captions".

1. GET /courses/yt_video_metadata?id=<youtube_id> → 500 when no YouTube API key is configured

load_metadata_from_youtube (lms/djangoapps/courseware/views/views.py:362) starts with status_code = 500 and only replaces it after calling YouTube. When YOUTUBE_API_KEY is unset (or PUT_YOUR_API_KEY_HERE, the default), it never calls YouTube and returns ({}, 500). On a default install, a missing key is expected configuration, not a server fault.

The extracted block has the same code (xblocks_contrib/video/video_utils.py:121 in openedx/xblocks-core).

Expected: with no key configured, answer 200 {} or a 4xx such as 404/501, and have the player skip the call when no key is configured.

2. GET …/handler/transcript/translation/<lang> → 500 when the transcript's file is missing

If an edx-val VideoTranscript row exists but its file is gone from storage, edxval.api.get_video_transcript_data raises edxval.exceptions.TranscriptNotFoundError. VideoConfigService.get_transcript (openedx/core/djangoapps/video_config/services.py:145) converts only xmodule.exceptions.NotFoundError into xblocks_contrib.video.exceptions.TranscriptNotFoundError. The edx-val exception gets past the handler's except TranscriptNotFoundError (a different class) and the request returns 500:

File ".../xblocks_contrib/video/video_handlers.py", line 269, in transcript
  content, filename, mimetype = get_transcript(
File ".../openedx/core/djangoapps/video_config/services.py", line 144, in get_transcript
File ".../openedx/core/djangoapps/video_config/transcripts_utils.py", line 1078, in get_transcript
File ".../openedx/core/djangoapps/video_config/transcripts_utils.py", line 560, in get_video_transcript_content
  transcript = edxval_api.get_video_transcript_data(edx_video_id, language_code)
File ".../edxval/api.py", line 301, in get_video_transcript_data
  raise TranscriptNotFoundError(err_msg) from f_err
edxval.exceptions.TranscriptNotFoundError: Transcript for video fdfa686f-… not found: /openedx/media/video-transcripts/ea9c25d6….srt

available_translations on the same block also answers 500.

Expected: also catch edxval.exceptions.TranscriptNotFoundError in the service, or in get_video_transcript_content, so the handler falls back to the static transcript and then answers 404.

On a stock Tutor install, the demo course always hits this case (overhangio/tutor#1506), so it shows on every demo video.

Environment: Tutor main (overhangio/openedx:23.0.0-main), demo course, 2026-10-09; code references are to master @ 2e46ebdf50.

Found by the Open edX end-to-end test suite (PLAT-002).

Activity

  1. added
    bugReport of or fix for something that isn't working as intended
    on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugReport of or fix for something that isn't working as intended

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions