[GH-ISSUE #4064] [Issue]: Backup download and profile export fail with Invalid string length #2192

Closed
opened 2026-10-21 05:46:08 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @SpicyMarinara on GitHub (Jul 24, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4064

Originally assigned to: @SpicyMarinara on GitHub.

Summary

On Marinara Engine 2.3.4, downloading a backup and exporting a profile fail for a large project/profile with a JavaScript RangeError: Invalid string length.

Expected behavior

Download Backup should create a usable backup archive, and Export Profile should create a usable profile export.

Actual behavior

Both operations fail instead of producing an export. The server throws RangeError: Invalid string length during JSON.stringify.

Steps to reproduce

  1. Run Marinara Engine 2.3.4 on Windows 11 with a large project/profile.
  2. Open the backup or profile export controls.
  3. Click Download Backup and observe that the operation fails with an Invalid string length error.
  4. Click Export Profile and observe that the operation fails with the same error.

Environment

  • Marinara Engine version: 2.3.4
  • Install type: other
  • OS + version: Windows 11
  • Browser or app shell: Not provided

Logs, screenshots, or video

Logs: {"level":50,"time":1784928904605,"pid":34020,"hostname":"DESKTOP-IP34AKF","err":{"type":"RangeError","message":"Invalid string length","stack":"RangeError: Invalid string length\n at JSON.stringify ()\n at Object. (file:///D:/MARINARA%20ENGINE/packages/server/dist/routes/backup.routes.js:1517:81)"},"msg":"[backup] Backup download failed"}

Logs: {"level":50,"time":1784928917250,"pid":34020,"hostname":"DESKTOP-IP34AKF","err":{"type":"RangeError","message":"Invalid string length","stack":"RangeError: Invalid string length\n at JSON.stringify ()\n at writeNativeProfileZip (file:///D:/MARINARA%20ENGINE/packages/server/dist/routes/backup.routes.js:786:39)\n at async sendNativeProfileZipExport (file:///D:/MARINARA%20ENGINE/packages/server/dist/routes/backup.routes.js:810:9)\n at async Object. (file:///D:/MARINARA%20ENGINE/packages/server/dist/routes/backup.routes.js:1604:24)"},"msg":"[backup] Profile export failed"}

Video: https://cdn.discordapp.com/attachments/1530329783039164496/1530329785480515714/Screen_Recording_2026-07-24_173520.mp4
Image: https://cdn.discordapp.com/attachments/1530329783039164496/1530329787736916209/image.png

Additional context

The user originally downloaded a release ZIP in the 1.4.x series and has updated automatically via start.bat. They suspect the failure is related to the size of their project/profile. A possible cause suggested by the user is that the export builds an extremely large profile manifest and buffers the ZIP in memory, but this has not been independently confirmed. The user currently uses a script to sync some folders to a phone installation, but it does not back up everything.

Discord thread: Invalid String Length error upon clicking both "Download Backup" and "Export Profile"
Discord thread link: https://discord.com/channels/1417099416812392641/1530329783039164496
Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653)

Discord thread transcript (2 messages)
[2026-07-24T21:44:12.429Z] Kiera: Hi, hello, apologies if this has been addressed before 🙇🏻‍♀️. I looked around for a little while and couldn't find much but I might just be missing something lol. Basically;
- OS: Windows 11
- I believe I downloaded a release zip back in 1.4.x but have since automatically updated with every start.bat
- Chatting mode isn't super relevant since this is about backups, but I use all three pretty frequently.

I asked Codex to take a look in my project folder bc I was getting the error you can see in the screen capture here. Whenever I try to download a backup *or* export the profile, I think the sheer size of what I have kinda overwhelms it >_> so it gives an "invalid string length" error and won't work. I don't quite know how to go about making the export smaller, but here's what Codex had to say:

*"So the raw backup data is probably copyable, but the built-in feature currently tries to build a huge profile manifest in memory first. After that, it also uses AdmZip and zip.toBuffer(), which means the whole ZIP is buffered in memory too. So there are probably two memory-pressure problems, but your current crash is the profile JSON string.
The best Engine-side fix would be to change Download Backup to stream the ZIP to a temp file using the existing stored ZIP writer, and avoid constructing marinara-profile.json as one enormous string. A smaller fallback fix would be: if the profile manifest is too large, still produce the raw full backup ZIP and include a note saying one-click Import Profile is unavailable for that archive, but manual restore is complete."*

I've not got much of a clue as to what that means but I will also paste the actual errors:

{"level":50,"time":1784928904605,"pid":34020,"hostname":"DESKTOP-IP34AKF","err":{"type":"RangeError","message":"Invalid string length","stack":"RangeError: Invalid string length\n    at JSON.stringify (<anonymous>)\n    at Object.<anonymous> (file:///D:/MARINARA%20ENGINE/packages/server/dist/routes/backup.routes.js:1517:81)"},"msg":"[backup] Backup download failed"}
{"level":50,"time":1784928917250,"pid":34020,"hostname":"DESKTOP-IP34AKF","err":{"type":"RangeError","message":"Invalid string length","stack":"RangeError: Invalid string length\n    at JSON.stringify (<anonymous>)\n    at writeNativeProfileZip (file:///D:/MARINARA%20ENGINE/packages/server/dist/routes/backup.routes.js:786:39)\n    at async sendNativeProfileZipExport (file:///D:/MARINARA%20ENGINE/packages/server/dist/routes/backup.routes.js:810:9)\n    at async Object.<anonymous> (file:///D:/MARINARA%20ENGINE/packages/server/dist/routes/backup.routes.js:1604:24)"},"msg":"[backup] Profile export failed"}

I think that's the gist of it. After seeing people's recent issues with losing their data, I've really wanted to properly back things up (up until now I was just using a script that I use to sync stuff to my phone's install since it has a few lines for automatic backup of some folders, but not everything). So any help would be much appreciated, but please don't like rush or anything 😭 you're all doing amazing work, this can wait and/or I'll do my best to work it out on my own if it's a skill issue on my part lol :tlrSalute: :zz_doglaugh:
[attached file: Screen_Recording_2026-07-24_173520.mp4 — https://cdn.discordapp.com/attachments/1530329783039164496/1530329785480515714/Screen_Recording_2026-07-24_173520.mp4?ex=6a652e2d&is=6a63dcad&hm=2c46badb0b0af3dc753d427329e50035d44eb8c9f27ae150570d5c2743c09600&]

[attached image 1: https://cdn.discordapp.com/attachments/1530329783039164496/1530329787736916209/image.png?ex=6a652e2d&is=6a63dcad&hm=559196b5995f748231ecf918f7920609a5e69abb132e81350ccae2e268e126f9&]
[Discord message: https://discord.com/channels/1417099416812392641/1530329783039164496/1530329783039164496]

[2026-07-24T21:54:57.764Z] Kiera: also the version I'm running now is 2.3.4, meant to add that up top :YikesNervous:
[Discord message: https://discord.com/channels/1417099416812392641/1530329783039164496/1530332489770340504]

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @SpicyMarinara on GitHub (Jul 24, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4064 Originally assigned to: @SpicyMarinara on GitHub. ## Summary On Marinara Engine 2.3.4, downloading a backup and exporting a profile fail for a large project/profile with a JavaScript RangeError: Invalid string length. ## Expected behavior Download Backup should create a usable backup archive, and Export Profile should create a usable profile export. ## Actual behavior Both operations fail instead of producing an export. The server throws RangeError: Invalid string length during JSON.stringify. ## Steps to reproduce 1. Run Marinara Engine 2.3.4 on Windows 11 with a large project/profile. 2. Open the backup or profile export controls. 3. Click Download Backup and observe that the operation fails with an Invalid string length error. 4. Click Export Profile and observe that the operation fails with the same error. ## Environment - Marinara Engine version: 2.3.4 - Install type: other - OS + version: Windows 11 - Browser or app shell: Not provided ## Logs, screenshots, or video Logs: {"level":50,"time":1784928904605,"pid":34020,"hostname":"DESKTOP-IP34AKF","err":{"type":"RangeError","message":"Invalid string length","stack":"RangeError: Invalid string length\n at JSON.stringify (<anonymous>)\n at Object.<anonymous> (file:///D:/MARINARA%20ENGINE/packages/server/dist/routes/backup.routes.js:1517:81)"},"msg":"[backup] Backup download failed"} Logs: {"level":50,"time":1784928917250,"pid":34020,"hostname":"DESKTOP-IP34AKF","err":{"type":"RangeError","message":"Invalid string length","stack":"RangeError: Invalid string length\n at JSON.stringify (<anonymous>)\n at writeNativeProfileZip (file:///D:/MARINARA%20ENGINE/packages/server/dist/routes/backup.routes.js:786:39)\n at async sendNativeProfileZipExport (file:///D:/MARINARA%20ENGINE/packages/server/dist/routes/backup.routes.js:810:9)\n at async Object.<anonymous> (file:///D:/MARINARA%20ENGINE/packages/server/dist/routes/backup.routes.js:1604:24)"},"msg":"[backup] Profile export failed"} Video: https://cdn.discordapp.com/attachments/1530329783039164496/1530329785480515714/Screen_Recording_2026-07-24_173520.mp4 Image: https://cdn.discordapp.com/attachments/1530329783039164496/1530329787736916209/image.png ## Additional context The user originally downloaded a release ZIP in the 1.4.x series and has updated automatically via start.bat. They suspect the failure is related to the size of their project/profile. A possible cause suggested by the user is that the export builds an extremely large profile manifest and buffers the ZIP in memory, but this has not been independently confirmed. The user currently uses a script to sync some folders to a phone installation, but it does not back up everything. Discord thread: Invalid String Length error upon clicking both "Download Backup" and "Export Profile" Discord thread link: https://discord.com/channels/1417099416812392641/1530329783039164496 Requested by: Marinara (marinara_spaghetti, Discord ID 169561011928432653) <details> <summary>Discord thread transcript (2 messages)</summary> ```text [2026-07-24T21:44:12.429Z] Kiera: Hi, hello, apologies if this has been addressed before 🙇🏻‍♀️. I looked around for a little while and couldn't find much but I might just be missing something lol. Basically; - OS: Windows 11 - I believe I downloaded a release zip back in 1.4.x but have since automatically updated with every start.bat - Chatting mode isn't super relevant since this is about backups, but I use all three pretty frequently. I asked Codex to take a look in my project folder bc I was getting the error you can see in the screen capture here. Whenever I try to download a backup *or* export the profile, I think the sheer size of what I have kinda overwhelms it >_> so it gives an "invalid string length" error and won't work. I don't quite know how to go about making the export smaller, but here's what Codex had to say: *"So the raw backup data is probably copyable, but the built-in feature currently tries to build a huge profile manifest in memory first. After that, it also uses AdmZip and zip.toBuffer(), which means the whole ZIP is buffered in memory too. So there are probably two memory-pressure problems, but your current crash is the profile JSON string. The best Engine-side fix would be to change Download Backup to stream the ZIP to a temp file using the existing stored ZIP writer, and avoid constructing marinara-profile.json as one enormous string. A smaller fallback fix would be: if the profile manifest is too large, still produce the raw full backup ZIP and include a note saying one-click Import Profile is unavailable for that archive, but manual restore is complete."* I've not got much of a clue as to what that means but I will also paste the actual errors: {"level":50,"time":1784928904605,"pid":34020,"hostname":"DESKTOP-IP34AKF","err":{"type":"RangeError","message":"Invalid string length","stack":"RangeError: Invalid string length\n at JSON.stringify (<anonymous>)\n at Object.<anonymous> (file:///D:/MARINARA%20ENGINE/packages/server/dist/routes/backup.routes.js:1517:81)"},"msg":"[backup] Backup download failed"} {"level":50,"time":1784928917250,"pid":34020,"hostname":"DESKTOP-IP34AKF","err":{"type":"RangeError","message":"Invalid string length","stack":"RangeError: Invalid string length\n at JSON.stringify (<anonymous>)\n at writeNativeProfileZip (file:///D:/MARINARA%20ENGINE/packages/server/dist/routes/backup.routes.js:786:39)\n at async sendNativeProfileZipExport (file:///D:/MARINARA%20ENGINE/packages/server/dist/routes/backup.routes.js:810:9)\n at async Object.<anonymous> (file:///D:/MARINARA%20ENGINE/packages/server/dist/routes/backup.routes.js:1604:24)"},"msg":"[backup] Profile export failed"} I think that's the gist of it. After seeing people's recent issues with losing their data, I've really wanted to properly back things up (up until now I was just using a script that I use to sync stuff to my phone's install since it has a few lines for automatic backup of some folders, but not everything). So any help would be much appreciated, but please don't like rush or anything 😭 you're all doing amazing work, this can wait and/or I'll do my best to work it out on my own if it's a skill issue on my part lol :tlrSalute: :zz_doglaugh: [attached file: Screen_Recording_2026-07-24_173520.mp4 — https://cdn.discordapp.com/attachments/1530329783039164496/1530329785480515714/Screen_Recording_2026-07-24_173520.mp4?ex=6a652e2d&is=6a63dcad&hm=2c46badb0b0af3dc753d427329e50035d44eb8c9f27ae150570d5c2743c09600&] [attached image 1: https://cdn.discordapp.com/attachments/1530329783039164496/1530329787736916209/image.png?ex=6a652e2d&is=6a63dcad&hm=559196b5995f748231ecf918f7920609a5e69abb132e81350ccae2e268e126f9&] [Discord message: https://discord.com/channels/1417099416812392641/1530329783039164496/1530329783039164496] [2026-07-24T21:54:57.764Z] Kiera: also the version I'm running now is 2.3.4, meant to add that up top :YikesNervous: [Discord message: https://discord.com/channels/1417099416812392641/1530329783039164496/1530332489770340504] ``` </details> ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:46:08 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Jul 25, 2026):

🔧 Ownership note: @SpicyMarinara is handling this in draft PR #4077 as part of the current open-issue sweep.

<!-- gh-comment-id:5077419639 --> @SpicyMarinara commented on GitHub (Jul 25, 2026): 🔧 Ownership note: @SpicyMarinara is handling this in draft PR #4077 as part of the current open-issue sweep.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#2192
No description provided.