Engine freezes on re-importing assets, Error: Condition "p_position > length" is true

Godot Version

Godot 4.7.1

Question

This is more of a: “I had a problem which I was able to find the solution myself, so I just want to help others by making my findings public.”

I was opening the engine and loading my project when the engine was stuck.

Deleting .godot didn’t help, so I looked at the console. Where this error continuously popped up:

Error: Condition “p_position > length” is true

Above this error, I found this:

File size 1769472 is smaller than the expected size 1777976.
at: load_from_buffer (scene/resources/audio_stream_wav.cpp:684)

I remembered I put a .wav file, which seems to be corrupted or incompatible.

Solution

I removed the corrupted .wav file and tried to load the project again. it worked.

Certainly the engine could handle this sort of problem better. It was difficult trying to find the error message itself

I think it’s next to impossible to handle every possible corrupted file or unexpected behaviour in any piece of software. Godot does have a few cryptic error messages for sure, but I don’t think it’s realistic to expect a detailed error message for every possible edge case such as this one.

With that said, maybe it’s worth creating an error report with a MRP on the Godot repo!

Hi, thanks for your reply! You’re right, guarding for any possible UB is unrealistic, but it was more meant in a way that it finding the exact error was a bit tedious.

This was more like a note, not a complaint :slight_smile:

For example, I wasn’t able to find the crashlogs, even though there was a folder with crashlogs, but in this case the freeze was hindering the crashlogs to be written (I think). Instead I had to look for the executable and divert stderr to a file myself, so that I actually get some sort of error message.

But maybe there would have been an easier way, I’m not sure. Cheers!