Skip to content

Show error on failed project save due to asset size limit - #1703

Open
mwtrew wants to merge 6 commits into
mainfrom
scratch-asset-size-limit
Open

mwtrew wants to merge 6 commits into
mainfrom
scratch-asset-size-limit

Conversation

@mwtrew

@mwtrew mwtrew commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

This PR introduces an error modal that's shown when the project fails to save due to an oversized asset. The modal tells the user that they need to remove the asset, and that saving the project will not be possible until they do so.

Implementation

Scratch's onShowAlert doesn't receive any information about why the save failed, so this approach patches Scratch's storage.store in order to be able to save error details to Redux at the time the upload fails. That allows us to determine whether the alert was caused by an oversized asset failing to upload, and show our error message accordingly.

Considerations

  • The error message appears on project save, not when the asset is added. This is because we're relying on the backend to decide whether the asset is oversized. In practice, our auto-save does kick in shortly after the upload.
  • We don't name the problematic asset in the error message. This would be difficult to do as the Scratch UI renames the asset to a hash before attempting to save it.
  • We don't automatically remove the oversized asset from the client-side project. One reason for this is that it's possible to create assets in the editor itself (e.g. recording sounds) - if we automatically removed such assets from the client-side project on a failed project save they would be lost permanently. This solution gives users a chance to work around it, for example by downloading the project.

This means we can tell when a 413 error was returned, record it and use it to
show our own error message.
Limited to 413 errors at the moment.
@mwtrew mwtrew changed the title Wrap Scratch storage and record 413 errors Show error on project save due to asset size limit Oct 21, 2026
Comment thread public/translations/en.json
Co-authored-by: macroscopeapp[bot] <170038800+macroscopeapp[bot]@users.noreply.github.com>
@mwtrew mwtrew changed the title Show error on project save due to asset size limit Show error on failed project save due to asset size limit Oct 21, 2026

This branch was successfully deployed

1 active deployment
previews/1703/merge — b325bccb Deployed Oct 21, 2026 by mwtrew via deploy-branch / build-deploy #6969
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant