Entity reference field definition to auto create entities I have a field definition set up like below. I want Drupal to do all the heavy lifting for me, so my definitions are minimal and rely on Drupal defaults: 

    $fields[$field] = BaseFieldDefinition::create('entity_reference')
        -&gt;setSettings([
            'target_type' =&gt; 'target_entity',
            'handler' =&gt; 'default',
            'handler_settings' =&gt; [
                'auto_create' =&gt; true,
            ],
        ])
        -&gt;setDisplayOptions('form', array(
            'weight' =&gt; $weight,
        ));
    ;


target_entity is just a simple bundleless entity.

This creates an entity reference auto-complete field in forms, but if I type something that doesn't match any existing entities, Drupal will say that no matching entities found and will refuse to create a new one. 

How do I make the auto_create setting work?
The answer is 'you cannot auto-create bundle-less entities in Drupal 8.2.0. I don't know if this is a bug or a feature, but you have to have a bundle for target entity ('all_target_entities' in my example) and indicate that as target bundle in the settings:

$fields[$field] = BaseFieldDefinition::create('entity_reference')
    -&gt;setSettings([
        'target_type' =&gt; 'target_entity',
        'handler' =&gt; 'default',
        'handler_settings' =&gt; [
            'auto_create' =&gt; true,
            'target_bundles' =&gt; [
                'all_target_entities' =&gt; 'all_target_entities',
            ],
        ],
    ])
    -&gt;setDisplayOptions('form', array(
        'weight' =&gt; $weight,
    ));
;


I think it was not the case up to some point, so stating the exact version I am having this issue with.