After I did a Backup and Migrate to a new system, I am getting two errors on any New Contact form. They are as follows:

Notice: Undefined property: CRM_Core_BAO_Tag::$tree in CRM_Core_BAO_Tag->getTree() (line 75 of /sites/all/modules/civicrm/CRM/Core/BAO/Tag.php).

Warning: Invalid argument supplied for foreach() in CRM_Contact_Form_Edit_TagsAndGroups::climbtree() (line 203 of /sites/all/modules/civicrm/CRM/Contact/Form/Edit/TagsAndGroups.php).

I also noticed that the tag box at the bottom of the page under "Tags and Groups" has gone missing. Is there any way to fix this problem without starting from scratch?

  • Exactly the same problem here when editing or adding a contact. I can't seem to resolve the problem like AJ described because my civicrm_tag table is empty; I don't have tags. What can be the cause in my case? Please check my comment below. – Kwantum May 12 '15 at 10:51
  • Seems to me this is a bug. When I create a new tag the warning is gone. So it occurs only when no tags exist or with the problem AJ described. – Kwantum May 12 '15 at 10:56

I figured out what happened. When I did the backup and migrate, Drupal set civicrm_tag.used_for to NULL. I set the field for all my tags to 'civicrm_contact' and it fixed the problem. No more errors. I just ran this query:
UPDATE civicrm_tag SET used_for='civicrm_contact';


I had deleted all my tags so the SQL query didn't help me at first.

I added one tag via civiCRM, then went into phpMyAdmin and just pasted civicrm_contact into the used_for field. That worked, though at that point I could have used the SQL query.

I was deleting all my contacts except a few administrators, so I could keep all the settings before importing 20k contacts, and also deleted all my tags when the problem occurred for me.

Thanks for the solution, I would never have figured out my own version without your help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.