Author Topic: Cannot load/save database due to "Destination array was not long enough"  (Read 252 times)

Rycia

  • Newbie
  • *
  • Posts: 6
I recently been getting an error every time I open MusicBee where my database is detected as corrupt and the previous version of it loads in. If I scan my library, let it complete, and reopen MusicBee again, the same thing occurs. I do use an automatic naming scheme that already has a method of keeping character limits under 250, as I'm using MusicBee on Windows.

Code
error loading associated files: Destination array was not long enough. Check destIndex and length, and the array's lower bounds.
I'm not sure if this has anything to do with the below error which is taken when I opened MusicBee:

Code
M:\Music\D\David Bowie\[1977] Heroes\David Bowie - Heroes - 1 04 - Sons Of The Silent Age [Remastered].mp3
4/3/2024 9:29:18 PM - error loading associated files: Destination array was not long enough. Check destIndex and length, and the array's lower bounds.
I'm not sure if that has anything to do with when I open back up, which gives me the following error:
Code
4/3/2024 9:56:57 PM - folder monitor failed: The system cannot find the path specified.
M:\Music\H\Hanz Zimmer\[2005] Madagascar OST\James Dooley - Madagascar OST - 1 B\Brad Paisley\[2016] Christmas Country\05 - B. J. Thomas.mp3
4/3/2024 11:17:33 PM - 10.0.22631.0 - 3.5.8698.34385P - System.NullReferenceException: Object reference not set to an instance of an object.
   at #=zrHxbKbKSSpgwvOQhk_k8Zbo=.#=zxPBnrelWvE7V(List`1 #=z7WyInvQ=)
   at #=zrHxbKbKSSpgwvOQhk_k8Zbo=.#=zW1HsXew7kBgN(List`1 #=z7WyInvQ=)
   at #=z$GDSv8hRlR$A95YRQDlYw74=.#=zRA38$x7htNRg.#=zZwrqXpNiyW6Y(BinaryWriter #=zoUxKRE4=, #=zrHxbKbKSSpgwvOQhk_k8Zbo= #=z_LPN_w8=)
   at #=z$GDSv8hRlR$A95YRQDlYw74=.#=zRA38$x7htNRg.#=zIDwjypc=(BinaryWriter #=zoUxKRE4=, #=zrHxbKbKSSpgwvOQhk_k8Zbo= #=z_LPN_w8=)
   at #=z$GDSv8hRlR$A95YRQDlYw74=.#=zRA38$x7htNRg.#=zKlxbhhiaGfGf(FileStream #=zpiz4leQ=)
   at #=z$GDSv8hRlR$A95YRQDlYw74=.#=zpaF8N$qd5sup.#=zW2MXBI0vtY$V(Boolean #=zFrVSS_N3wLHid$BdrA==)
   at #=z$GDSv8hRlR$A95YRQDlYw74=.#=zpaF8N$qd5sup.#=zR$pFUbcqH880()
   at #=zLOCqjAQb_n7nGSIoJBLyEMw=.#=zsAm07HwXmz8z()
   at #=zNw1gc6dmr6WcbwzSi_PPhpuKB_Qz.#=z4MX56lI=.#=z6TdWG9I=(CloseReason #=zFs60cqA=)

4/7/2024 9:27:27 PM - 10.0.22631.0 - 3.5.8698.34385P - System.IO.InvalidDataException: Found invalid data while decoding.
   at #=z$GDSv8hRlR$A95YRQDlYw74=.#=zRA38$x7htNRg.#=znYCTaug=(FileStream #=zpiz4leQ=)
   at #=z$GDSv8hRlR$A95YRQDlYw74=.#=zpaF8N$qd5sup.#=z$LVgOh2R4clFGsn7Lw==(#=zOPAFmqxyWq4nEsXBtA== #=z1bX7GopeSWGH)

The files aren't corrupt and are perfectly playable, so this confuses me.

Here's the string I use for naming my files:
Code
$Left($Group(<Sort Album Artist>,1)\<Sort Album Artist>\[<Year>"] "<Album>\$Left(<Artist>,20)" - "$Left(<Album>,25)" - "<Disc#>" "<Track#>" - "<Title>,258)

I have like 30k tracks so scanning my tracks I added in over and over again every time I launch MusicBee isn't too practical.

Steven

  • Administrator
  • Sr. Member
  • *****
  • Posts: 34371
the issue might be with an associated file rather than the music file itself
This should stop the database corruption, but there is something going wrong while a new file is loaded, so could send me the startup error message "error loading associated files..." the next with the filename and activity message that appears after the error message

https://getmusicbee.com/patches/MusicBee35_Patched.zip
unzip and replace the existing musicbee application files

Rycia

  • Newbie
  • *
  • Posts: 6
the issue might be with an associated file rather than the music file itself
This should stop the database corruption, but there is something going wrong while a new file is loaded, so could send me the startup error message "error loading associated files..." the next with the filename and activity message that appears after the error message

https://getmusicbee.com/patches/MusicBee35_Patched.zip
unzip and replace the existing musicbee application files

After further testing, it seems to definitely be a problem with Windows's file path limit. I reorganized my library removing
Code
 - "$Left(<Album>,25)"
from my library organization string, and whatever was being problematic was knocked down below that limit, and everything would save/load into the database after a reorganization,
Not sure why this really is a problem.

Because that fixed the issue (without the 35 patched version,) I'd suggest adding a setting somewhere to clip file names over the file path that doesn't rely on regex, or find a way to release the file path limit if possible. I also wasn't able to get the errors after this because I cleared my log. If this occurs again (since what I did was a temporary fix,) I'll get logs again.

I would also mention that I have ran into this issue multiple times before and just had to adjust my naming string to fix it and make it shorter, so it's reproducible if you just somehow get the file to have a full path over (i think? I don't know the exact number) 255 or like 258 characters on Windows using auto organize (or potentially from any source.) May be a sort of limitation on the programming language(s). You can use my string and make the tagging information really long to try and test this, scan the file in, close, and open it and it'll be corrupt. I am using the latest version of MusicBee at time of writing as well.

hiccup

  • Sr. Member
  • ****
  • Posts: 7911
Good that you found the cause and the solution after some investigation.

I personally don't think that MusicBee should be restrictive in what a user is able to do with longer file paths.
Nor should it be truncating things for you 'in the background'.

But perhaps the error message "Destination array was not long enough" could be rephrased and advertised in a more user-friendly manner.