If the WBQualityConstraintsCacheCheckConstraintsResults config is true (which is the default), WikibaseQualityConstraints will cache constraint check results. For this, it needs to know the latest revision ID of all referenced entities, so that the results can be invalidated if those entities are edited. However, it does this using a metadata lookup that only supports local entities:
$wikiPageEntityMetaDataAccessor = $repo->getLocalRepoWikiPageMetaDataAccessor();
This is incorrect and causes constraint checks to crash when running on a wiki with federated entities (e. g. (Beta) Commons) – see T244572#5864108 for a stack trace.
Either the service wiring needs to recognize when some entity types aren’t local, and disable caching in that case (because getLocalRepoWikiPageMetaDataAccessor() can’t be used), or WikibaseRepo needs to offer some WikiPageEntityMetaDataAccessor that works for all entity types.