This isn't related to the Media/File itself I believe, but rather something that references the media and that isn't deleted accordingly when the media goes away.
This is the case for bookmarks, but given the database, it's unrelated to this crash (there's no bookmark in there)
Confirmed, setting the genre_id to NULL in the media allows it to go away, but the Genre table doesn't impose any restriction on the media, and the various triggers shouldn't cause a foreign key related issue as they just update counters
The trigger is incorrect when decrementing the number of tracks. It decrements nb_tracks then is_present which could theoretically cause a CHECK constraint violation since we have CHECK(is_present <= nb_tracks) in the schema.
The DeleteEmpty trigger is beyond broken, as it just DELETE FROM Genre without any WHERE clause, which will cause all genre to be removed when a single genre reaches 0 tracks.
So what happens here is that deleting media 98 is causing the Genre 4 to reach nb_tracks = 0 which causes the genre_delete_empty trigger to kick in, which delete all genre while they are still referenced by other media, hence the foreign key violation.