Newbie Question - "Uncaught RangeError: Invalid string length" when importing images

Hi folks! I’m brand new (like, 48 hours new) to TiddlyWiki and currently am only using the UI without any scripting.

I’m trying to import a large collection of images (mainly JPGs) into Tiddly for tagging and organizing, but am starting to run into a JavaScript error every time I import an image: “Uncaught RangeError: Invalid string length”

This happens both in Chrome (Version 108.0.5359.125 (Official Build) (64-bit)) and in TiddlyDesktop (version 0.0.16). I’m using Windows 11 Pro (OS build 22621.1105).

The error occurs both when importing individual files and groups of files, and occurs regardless of whether the image(s) are drag-and-dropped into the interface or uploaded through the built-in “Import” function. Neither renaming nor resizing the files prior to importing appears to make a difference. Relocating the files on my hard drive doesn’t seem to matter either. The error seems to be format-independent (occurs for .jpg, .png, .pdf).

I was able to import 100 or so images without issue prior to this. The error then began popping up intermittently and now seems to happen every time I try to import an image.

Any ideas for rectifying this would be greatly appreciated!

Can you right click to open the developer tool, and screenshot the red text in the console tab, so we can know which code causes the error?

P.S. I think this is better being a issue in github repo. If you haven’t install any plugin.

Here’s a screenshot of the error in the UI and one of the console tab:

If you have AutoSave enabled, try disabling it and try importing images and then manually triggering a save. See if that helps.

What saving method/mechanism are you using?

How big is your TW file now?

@saqimtiaz I did have autosave enabled. When I disable it, I’m able to import images with no problem but then get the same error when I try to manually save.

@Mark_S The file is currently 511MB

There’s your problem.

https://tiddlywiki.com/#ExternalImages

1 Like

The title of that image on the example also looks unexpectedly complex;
225 'Hanalei'. One of the trendy boutique art clothing stores on Kuhio Highway next to Ching oung Village.jpg

  • it may be fine but worth checking if it only occurs on complex filenames.
1 Like

Thanks for this! I’ve switched to linking to external media through the “_canonical_uri” field, which seems to work perfectly except for being fairly labor intensive for large sets of media. Appreciate your help!

Keep in mind there are a range of additional ways to do this and has being discussed a number of times, such as the file uploads plugin development and more. This Thread was initially about the error, but to get help improving your work flow, (reduce the labor intensity) perhaps search for external and _canonical_uri in the forums and/or start a new topic for help.

  • If this is a one off issue it may not be worth the extra time
  • If you plan to do a lot more images or multiple wikis this way it would be worth exploring the options.

Check this.

If I remember correctly @TiddlyTweeter had told about some method for bulk embedding external images from a local folder sometime back (an old google group post I guess). May be he can share some information.

1 Like