How to add a base field for an entity reference to a specific vocabulary I have an Entity: EntityX.  It installs correctly and works the way that I want it to; with, of course, one exception.

I want to attach an entity reference to a specific vocabulary.  I have tried:

My vocabulary's machine name is: custom_vocabulary

In EntityX's definition I have the following defined in the baseFieldDefinitions function:

$fields['my_custom_vocabulary'] = BaseFieldDefinition::create('entity_reference')
  -&gt;setLabel(t('Vocabulary'))
  -&gt;setDescription(t('What was this tagged with.'))
  -&gt;setSetting('target_type', 'custom_vocabulary')
  -&gt;setSetting('handler', 'default')
  -&gt;setDisplayOptions('view', array(
    'label' =&gt; 'above',
    'type' =&gt; 'author',
    'weight' =&gt; -3,
  ))
  -&gt;setDisplayOptions('form', array(
    'type' =&gt; 'entity_reference_autocomplete',
    'settings' =&gt; array(
      'match_operator' =&gt; 'CONTAINS',
      'size' =&gt; 60,
      'placeholder' =&gt; '',
    ),
    'weight' =&gt; -3,
  ))
  -&gt;setDisplayConfigurable('form', TRUE)
  -&gt;setDisplayConfigurable('view', TRUE);


But when I go to install it, I get the following error: 

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "custom_vocabulary" entity type does not exist. in /brew/www/html/core/lib/Drupal/Core/Entity/EntityTypeManager.php:133


While looking at the article defined in the installation profile for Drupal, I see that they use it as a field and not a true entity reference.  Is there no way for me to do it this way?  I can't have this all nicely bundled into one single entity.

What I don't know how to do is add a term from a vocabulary to an entity type.
Vocabularies are bundles of the entity type taxonomy term. If you want to reference a vocabulary then first set taxonomy_term as target type and second restrict the field to a specific vocabulary as target bundle:

$definition = BaseFieldDefinition::create('entity_reference')
  -&gt;setSetting('target_type', 'taxonomy_term')
  -&gt;setSetting('handler_settings', ['target_bundles' =&gt; ['custom_vocabulary' =&gt; 'custom_vocabulary']]);


See change record https://www.drupal.org/node/2576151