Skip to content

fix: fall back to block type when XBlock plugin is missing - #39152

Open
rpenido wants to merge 3 commits into
openedx:masterfrom
open-craft:rpenido/fix-clipboard-display-name-missing-xblock
Open

rpenido wants to merge 3 commits into
openedx:masterfrom
open-craft:rpenido/fix-clipboard-display-name-missing-xblock

Conversation

@rpenido

@rpenido rpenido commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

StagedContentSerializer.get_block_type_display raised PluginMissingError when the XBlock for the staged content's block type is not installed, so reading the clipboard failed. Because the clipboard is embedded in the course index response (initial_user_clipboard), that made GET /api/contentstore/v1/course_index/<course_key> return 500 for every course the user could open, and /api/content-staging/v1/clipboard/ failed as well — with no API to discard the stale clipboard, the author is stuck.

The clipboard keeps a copy of a block, so the plugin can be removed from the platform after the copy was made (e.g. an operator drops a custom XBlock, or the platform is upgraded and a third-party block goes away).

The fix falls back to the raw block type, which is what openedx.core.djangoapps.xblock.api.xblock_type_display_name already does for v2 libraries:

try:
    component_class = XBlock.load_class(block_type)
except PluginMissingError:
    # We want to be able to give *some* value, even if the XBlock is later uninstalled.
    return block_type

Impacted roles: Course Author

Supporting information

Testing instructions

  1. Install a third-party XBlock
  2. Add it to a course
  3. Copy the block to the clipboard
  4. Uninstall the plugin
  5. Restart the LMS/CMS
  6. Create a new course and open it

Before this change, the course index API returns 500; and the course will not render.
Checking out this branch and the course will render.

Deadline

None.

Other information

None.


Private ref: FAL-4394

…issing

The clipboard holds a *copy* of a block, so its XBlock plugin may no
longer be installed (e.g. a custom XBlock was removed from the
platform).  StagedContentSerializer.get_block_type_display() called
xblock_type_display_name(), which raises PluginMissingError in that
case, so reading the clipboard raised, and because the clipboard is
embedded in the course index response (initial_user_clipboard), the
whole course index request 500s -- for every course, for any user who
happens to have such a clipboard.  The same applies to the
/api/content-staging/v1/clipboard/ endpoint, and there is no API to
discard the stale clipboard, so authors get stuck.

Fall back to the raw block type, mirroring
openedx.core.djangoapps.xblock.api.xblock_type_display_name, which
already handles a missing plugin this way.
@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Sep 25, 2026
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @rpenido!

This repository is currently maintained by @openedx/wg-maintenance-openedx-platform-oncall.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@mphilbrick211 mphilbrick211 added the needs reviewer assigned PR needs to be (re-)assigned a new reviewer label Sep 29, 2026

@samuelallan72 samuelallan72 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rpenido 👍 nice catch, works for me :)

  • I tested this: followed the test instructions
  • I read through the code
  • I checked for accessibility issues
  • Includes documentation

@rpenido

rpenido commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Hi @bradenmacdonald! Could you review this when you have some time?

@rpenido rpenido changed the title fix(content_staging): fall back to block type when XBlock plugin is missing fix: fall back to block type when XBlock plugin is missing Oct 1, 2026
@bradenmacdonald

Copy link
Copy Markdown
Contributor

@rpenido Yep! I'll review when I can.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs reviewer assigned PR needs to be (re-)assigned a new reviewer open-source-contribution PR author is not from Axim or 2U

Projects

Status: Ready for Review

Development

Successfully merging this pull request may close these issues.

5 participants