Plain .yaml save can write a file that load rejects as "Layout file too large"
Summary
Saving a layout as plain .yaml embeds uploaded device images as base64 data URLs with no cap on total file size. Loading a plain .yaml file rejects anything over 5MB. Users with a few large custom images can save a layout they can no longer open.
Reported by user
I made a rack layout with Count Racula, saved it out to .yaml - and made the mistake of updating chrome. Now when i try to load it - says file is too large. Is there a way to increase the file size limit? Or a way to look into the yaml and compress?
The Chrome update is probably coincidental. The size check runs in our code and doesn't depend on the browser version.
Steps to reproduce
- Create a layout and add a device.
- Upload a custom front image close to the 5MB upload limit (
MAX_IMAGE_SIZE_MB = 5). - Save the layout as
.yaml. The save succeeds, with at most a non-blocking "consider optimising" toast. - Open the saved
.yaml.
Expected: The layout loads, or the save warns that the file will be too large to reopen.
Actual: Load fails with Layout file too large (NMB). Max size is 5MB.
Base64 adds about 33%, so roughly 3.75MB of raw images across all devices is enough to cross the limit. A single 5MB image produces a ~6.7MB file on its own.
Cause
Code references are from main at 4a34879 (v26.10.1).
- Save:
downloadYamlFile()insrc/lib/utils/archive.ts(L274) callsencodeUserImagesToYaml()insrc/lib/utils/image-encoding.ts(L158). That function counts images overSAVE_WARN_BYTES(100KB) for a toast and never checks the total. - Load:
extractFolderArchive()insrc/lib/utils/archive-extract.ts(L270) rejects non-ZIP input overLIMITS.MAX_YAML_BYTES(5 * 1024 * 1024, L150) before parsing. - Upload:
MAX_IMAGE_SIZE_MB = 5insrc/lib/types/constants.ts(L181) allows a single image that already breaks the round trip once encoded.
The comment at archive-extract.ts L266 covers the deliberate mismatch between the 5MB local limit and the 1MB server PUT limit (#617). It doesn't cover local save producing a file local load can't read.
Possible fixes
- Block or warn at save time when the serialized YAML exceeds
MAX_YAML_BYTES, and point the user to the ZIP export, which stores images as files and allows 50MB. - Raise
MAX_YAML_BYTESfor plain YAML to fit the worst case the upload limit allows, or apply the limit to the layout body only and validate theimages:section per image (the decoder already checks each image againstMAX_IMAGE_SIZE_BYTES). - Downscale or re-encode uploaded images on import so embedded data stays small.
- Make the load error say that embedded images are the likely cause and how to recover.
Recovery for affected users
Delete the trailing images: section from the .yaml in a text editor and load it again. The layout comes back without its custom images.
Still to confirm with the user
- File size of the
.yaml - Whether they uploaded custom device images, and roughly how many
- count.racku.la or self-hosted, and which Rackula version
- Exact error text (a screenshot would do)