How to use get_terms() returning only the terms that have posts with a certain custom field value

Try to do this:

$args = array(
  'taxonomy' => 'kategorien',
  'orderby' => 'slug',
  'order' => 'ASC',
  'hide_empty' => true,
  'meta_key' => 'YOUR_KEY_VALUE',
  'meta_value' => true
);

$terms = get_terms( $args );

error code: 523