For example: https://www.wikidata.org/wiki/Wikidata:Main_Page?uselang=invalid – click on the Wikidata logo and you’ll be sent to https://www.wikidata.org/wiki/Main_Page (notice the missing Wikidata: namespace), which is a deleted page. This only seems to happen when the language code is something invalid (doesn’t have to be the literal string invalid).
Do we use some evil hack to change the target of the logo link and the hack is for some reason not loaded for invalid language codes?