# Files with Bad Metadata Asserting Audio File Reader

**URL:** <https://forum.juce.com/t/files-with-bad-metadata-asserting-audio-file-reader/48757>\
**Category:** Audio Plugins\
**Created:** [November 13, 2021, 6:38am UTC](https://forum.juce.com/t/files-with-bad-metadata-asserting-audio-file-reader/48757 "2021-11-13T06:38:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JerContact](https://avatars.discourse-cdn.com/v4/letter/j/3e96dc/32.png) [@JerContact](https://forum.juce.com/u/JerContact)\
**Post date:** [November 13, 2021, 6:38am UTC](https://forum.juce.com/t/files-with-bad-metadata-asserting-audio-file-reader/48757/1 "2021-11-13T06:38:34Z")

</div>

I’m getting an error in this line when the Audio Format Reader is trying to build out all the metadata information:

values.set (WavAudioFormat::bwavOriginator, String::fromUTF8 (originator, sizeof (originator)));

My code looks like this:

std::unique\_ptrjuce::AudioFormatReader reader(formatManager.createReaderFor(myFile));

It works great on most files, but any files with curropt metadata it asserts. Is there anyway to skip over that metadata or somehow not assert?!

---

<div class="post-metadata">

**Author:** ![cpr2323](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/cpr2323/32/18682_2.png) [@cpr2323](https://forum.juce.com/u/cpr2323)\
**Post date:** [November 13, 2021, 2:51pm UTC](https://forum.juce.com/t/files-with-bad-metadata-asserting-audio-file-reader/48757/2 "2021-11-13T14:51:34Z")

</div>

Asserts should only interrupt your program while you are in the debugger. While this can be annoying while debugging, it doesn’t impact your shipping code, unless the assert results in a subsequent crash. One of the great things about JUCE is that you have the source code, so if this is too disruptive during development, you can just go in and comment out the assert while you are in development.

---

<div class="post-metadata">

**Author:** ![xenakios](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/xenakios/32/4047_2.png) [@xenakios](https://forum.juce.com/u/xenakios)\
**Post date:** [November 13, 2021, 4:29pm UTC](https://forum.juce.com/t/files-with-bad-metadata-asserting-audio-file-reader/48757/3 "2021-11-13T16:29:00Z")

</div>

The problem here is that the jassert happens in the Juce String code, and commenting out the jassert from that is potentially a quite disruptive change as so many things in Juce use the String class. Detecting the corrupt/incompatible metadata should IMHO already happen in the Wav file parser itself.

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [November 13, 2021, 9:46pm UTC](https://forum.juce.com/t/files-with-bad-metadata-asserting-audio-file-reader/48757/4 "2021-11-13T21:46:26Z")

</div>

Just added an answer in the other thread where you asked:

> [@Juce\_string.cpp assertion failure while trying to create an AudioFormatReader](https://forum.juce.com/t/juce-string-cpp-assertion-failure-while-trying-to-create-an-audioformatreader/41578/12):
>
> The good news is it’s just an assertion. In a release build you just get a string in the metadata with invalid characters. Whatever happens subsequently depends on the calling code. Unfortunately I think there is no easy fix. You can turn the jassert (CharPointer\_UTF8::isValidString (buffer, bufferSizeBytes)); into an if to catch it, but there is no way to know the actual encoding if it’s not UTF8. Something like this could work: if (CharPointer\_UTF8::isValidString (buffer, bufferSizeBytes)…
