Problem while using the user_reference field in my bundle I am creating an entity for my D7 Module and trying to include a user_reference auto-complete field in it. The autocomplete-field shows up correctly with the add-more option since I have set cardinality to unlimited.

However, nothing shows up in auto-complete suggestions and it doesn't accept any of the user-instances.

Even more annoying is that when I go and check the field settings in
Home » Administration » Structure » Content types » » Manage fields
and click on Save without making any changes, the suggestions start appearing correctly as they should.

I have written down the following settings for the field and the instance.

field :

'vocabulary_authors' =&gt; array(
      'field_name' =&gt; 'vocabulary_authors',
      'type'        =&gt; 'user_reference',
      'settings' =&gt; array(
        'referenceable_roles' =&gt; array('2','3'),  // for authenticated user + administrator
        'referenceable_status' =&gt; array('1'),    // for active
      ),
      'default_widget' =&gt; 'user_reference_autocomplete',
      'default_formatter' =&gt; 'user_reference_default',
      'cardinality' =&gt; FIELD_CARDINALITY_UNLIMITED,
    ),


instance :

'vocabulary_authors' =&gt; array(
      'field_name'  =&gt; 'vocabulary_authors',
      'label'       =&gt; $t(' Authors'),
      'bundle' =&gt; 'vocabulary',
      'entity_type' =&gt; 'node',
      'description' =&gt; '',
      'required'    =&gt; FALSE,
      'widget' =&gt; array(
        'type'    =&gt; 'user_reference_autocomplete',
        'settings' =&gt; array(
         'autocomplete_match' =&gt; 'starts_with',
        ),
      ),


Please help me out here. I think I am I missing out on some required settings.
You are missing the module definition, though I'm not sure it's required.

The easiest thing to do it so use field_info_field and field_info_instance for the field to see what info Drupal provides and fill in the blanks until every works.