I couldn't find this error in the issue queue, but I'm receiving it very often: after a cache flush, when visiting structure>views, after saving a view, after enabling modules, and many other occasions. Refreshing the page temporarily rids the error, and I've noticed this with all roles.

The error:
Notice: Undefined index: vocabulary in taxonomy_field_views_data() (line 415 of <path>/sites/all/modules/views/modules/taxonomy.views.inc).

taxonomy.views.inc line 415:

$data[$table_name][$field_name]['filter']['vocabulary'] = $field['settings']['allowed_values'][0]['vocabulary'];

taxonomy.views.inc conflicting function (I commented // HERE after it):

/**
 * Implements hook_field_views_data().
 *
 * Views integration for taxonomy_term_reference fields. Adds a term relationship to the default
 * field data.
 *
 * @see field_views_field_default_views_data()
 */
function taxonomy_field_views_data($field) {
  $data = field_views_field_default_views_data($field);
  foreach ($data as $table_name => $table_data) {
    foreach ($table_data as $field_name => $field_data) {
      if (isset($field_data['filter'])) {
        $data[$table_name][$field_name]['filter']['handler'] = 'views_handler_filter_term_node_tid';
        $data[$table_name][$field_name]['filter']['vocabulary'] = $field['settings']['allowed_values'][0]['vocabulary']; // HERE
      }
    }

    // Add the relationship only on the tid field.
    $data[$table_name][$field['field_name'] . '_tid']['relationship'] = array(
      'handler' => 'views_handler_relationship',
      'base' => 'taxonomy_term_data',
      'base field' => 'tid',
      'label' => t('term from !field_name', array('!field_name' => $field['field_name'])),
    );

  }

  return $data;
}

Comments

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

        $data[$table_name][$field_name]['filter']['vocabulary'] = $field['settings']['allowed_values'][0]['vocabulary']; // HERE

It's not so hard to open a file and look after this line :)

Can you please write something like dvm or similar to look which field has this problem?
Then look at this field and see whether you have a vocabulary selected or not.

ownage’s picture

Status: Postponed (maintainer needs more info) » Fixed

I found it was the Migrate Examples module conflicting. Upon deleting all the vocabularies and content types the module populated, the notice cannot be duplicated.

timothykc’s picture

Ditto for me. Errors appeared after installing Migrate Examples, and disappeared after deleting the vocab/content type.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

AlternateRoute’s picture

It is hard to say it is fixed if you have to delete all the vocabularies and content types that were imported.
A better solution would be if there was a way to identify the specific vocabulary or content type causing the problem and then fix it.

Anonymous’s picture

Status: Closed (fixed) » Active

I reopen this issue because I have the same error and cannot find the cause. I did not use the Migrate Examples module.

What I did:
- I made two taxonomy vocabularity items
- I changed the default taxonomy system name
- I used taxonomy_csv, to import terms but the import was not succesfull.
- So I uninstalled taxonomy_csv
- I added the terms by hand
- I made a contenttype with a term relation field
- I made a view with this content type
- Then I noticed this error
- Searching for a solution I deleted al the taxonomy vocabularity items, the view and the term relation field,
- And made a new setup clean, by hand.

The error is stil there: generated two times with the same error text,
The error is not always on screen, only after cache flushing or opening admin/structure/views.

dawehner’s picture

Please have a look whether you have a taxonomy reference field without a vocabulary selected.
This is basically the problem here all the time.

Anonymous’s picture

I found field_name 'taxonomy_relation' (type 'taxonomy_term_reference') in de database-field 'field_config' and did not recognize this field. This field is not shown in drupal admin/reports/fields. The error is gone after deleting this field in the database.

I don't know where the field is from, possible a leftover from a deleted module, with a not correct working uninstall. I am not sure I did the correct thing. The error is gone.

dawehner’s picture

Status: Active » Fixed

Update status.

GlobalRaj’s picture

Status: Fixed » Needs work

When ever I was loading Structure > Views or did any other activities with Views, I kept getting the following error.

Notice: Undefined index: vocabulary in taxonomy_field_views_data() (line 415 of
/sites/all/modules/views/modules/taxonomy.views.inc).

The same error repeats for 11 more times

But after going through above postings, I went ahead and disabled the Migrate Example. That seemed to have solved the issue. But I think some work needs to be done (Views / Migrate) in order for that error to not come up.

Cheers!
Raj

dawehner’s picture

Do you have this error on the current dev version as well?

dawehner’s picture

Status: Needs work » Closed (won't fix)

As that's actually a migrate/whatever issue, which can't happen on normal configuration mark it as won't fix