While working on a hot-fix for T259745: Uncaught ArgumentCountError: Too few arguments to function OOUI\Tag::appendContent(), 0 passed I realized the Wikimedia-production-error probably hints at another bug. This is the code that failed:
$layout->appendContent( ...$this->getCaptionsContent( $entity->getLabels(), $this->getLanguagesOrderedByFallbackChain( $entity ) ) );
Since appendContent() requires at least one argument, it fails when getCaptionsContent() returns an empty array. But wait, how is this possible? getLanguagesOrderedByFallbackChain() is documented to return at least the interface language. So it should be impossible that getCaptionsContent() returns nothing. How can the interface language get lost?
The LanguageFallbackChain in question is created in WikibaseMediaInfoHooks::createEmptyStructuredData() with no $mode flag set, which means it should default to FALLBACK_ALL when LanguageFallbackChainFactory::newFromLanguage() is called. That should always include the original language in the result – but the code path is not obvious.
I guess the task is to find out what's going on here, under which circumstances this LanguageFallbackChain can be empty, or add tracking code for this edge-case and monitor this potential bug further.