Smart Tag Management degraded after adding a tag and delete the duplicate

What have I done?

  • I wanted to ad a tag to my custom tag category
  • So I went to Settings, Region Tags, MyCompany Tags, chose my tag category “services”, added a new entry and clicked on Actions → Add
  • I saw my new entry in the list and a second time blinking, thats the point it broke up I guess
  • I was confused that I managed it to get the same tag value twice
  • I deleted one duplicate, I confirmed the validation to delete this entry, nothing changed
  • So I tried to reload the tags by changing the category to another and back to “services” from this time it dont loaded the tags from this category anymore


  • Version: ivanchuk-1
  • Environment: 3 appliances with one database only server
  • tag category “services” is configured as follows
Name Description Show in Console Single Value Capture C & U Data Default
services MyCompany Services true true false false

What I have tried

  • I tried to delete the category but I cant delete it, deleting just dont work on this category
  • I tried to tag a vm with my new tag value, at this point vm → policy → edit tags → the “services” tags are loading and I see my new entry
    but saving the tag dont work

Error during ‘Save Tags’: undefined method `````name’ for nil:NilClass

  • I restarted the appliance 2 where the webserver is running
  • I looked the vmdb_production in the console and did a SELECT * FROM tags; and I found my entry at the bottom

What is degraded?

  • listing and editing the tag values of the category “services” dont work, also deleting the category dont work
  • assign the latest entry of “services” to any object dotn work
  • last but not least I cant add or change the Filter Expression of all user groups! my guess is that this is related to the broken tag (Settings → Access Control → Groups → Assigned Filters → Filter Expression) this is a real issue for me

Errors and Logs

Error during ‘Save Tags’: undefined method `name’ for nil:NilClass


[----] I, [2021-02-03T19:30:09.603885 #2902:6b3c800] INFO -- : MiqAeEvent.build_evm_event >> event=<:request_unassign_company_tag> inputs=<{"MiqEvent::miq_event"=>1645000032250565, :miq_event_id=>1645000032250565, "EventStream::event_stream"=>1645000032250565, :event_stream_id=>1645000032250565}> [----] I, [2021-02-03T19:30:09.635563 #2902:6b3c800] INFO -- : MiqAeEvent.build_evm_event >> event=<:unassigned_company_tag> inputs=<{"MiqEvent::miq_event"=>1645000032250566, :miq_event_id=>1645000032250566, "EventStream::event_stream"=>1645000032250566, :event_stream_id=>1645000032250566}> [----] I, [2021-02-03T19:30:09.664828 #2902:6b3c800] INFO -- : MiqAeEvent.build_evm_event >> event=<:request_unassign_company_tag> inputs=<{"MiqEvent::miq_event"=>1645000032250567, :miq_event_id=>1645000032250567, "EventStream::event_stream"=>1645000032250567, :event_stream_id=>1645000032250567}> [----] I, [2021-02-03T19:30:09.665776 #2902:6b3c6e8] INFO -- : MiqAeEvent.build_evm_event >> event=<:request_unassign_company_tag> inputs=<{"MiqEvent::miq_event"=>1645000032250568, :miq_event_id=>1645000032250568, "EventStream::event_stream"=>1645000032250568, :event_stream_id=>1645000032250568}> [----] I, [2021-02-03T19:30:09.696596 #2902:6b3c6e8] INFO -- : MiqAeEvent.build_evm_event >> event=<:unassigned_company_tag> inputs=<{"MiqEvent::miq_event"=>1645000032250569, :miq_event_id=>1645000032250569, "EventStream::event_stream"=>1645000032250569, :event_stream_id=>1645000032250569}> [----] I, [2021-02-03T19:30:09.700460 #2902:6b3c800] INFO -- : MiqAeEvent.build_evm_event >> event=<:unassigned_company_tag> inputs=<{"MiqEvent::miq_event"=>1645000032250570, :miq_event_id=>1645000032250570, "EventStream::event_stream"=>1645000032250570, :event_stream_id=>1645000032250570}> [----] I, [2021-02-03T19:30:09.725289 #2902:6b3c6e8] INFO -- : MiqAeEvent.build_evm_event >> event=<:request_unassign_company_tag> inputs=<{"MiqEvent::miq_event"=>1645000032250571, :miq_event_id=>1645000032250571, "EventStream::event_stream"=>1645000032250571, :event_stream_id=>1645000032250571}> [----] I, [2021-02-03T19:30:09.726198 #2902:6b3c800] INFO -- : MiqAeEvent.build_evm_event >> event=<:request_assign_company_tag> inputs=<{"MiqEvent::miq_event"=>1645000032250572, :miq_event_id=>1645000032250572, "EventStream::event_stream"=>1645000032250572, :event_stream_id=>1645000032250572}> [----] I, [2021-02-03T19:30:09.756401 #2902:6b3c6e8] INFO -- : MiqAeEvent.build_evm_event >> event=<:unassigned_company_tag> inputs=<{"MiqEvent::miq_event"=>1645000032250573, :miq_event_id=>1645000032250573, "EventStream::event_stream"=>1645000032250573, :event_stream_id=>1645000032250573}> [----] I, [2021-02-03T19:30:09.772237 #2902:6b3c800] INFO -- : MiqAeEvent.build_evm_event >> event=<:assigned_company_tag> inputs=<{"MiqEvent::miq_event"=>1645000032250574, :miq_event_id=>1645000032250574, "EventStream::event_stream"=>1645000032250574, :event_stream_id=>1645000032250574}> [----] I, [2021-02-03T19:30:09.781418 #2902:6b3c6e8] INFO -- : MiqAeEvent.build_evm_event >> event=<:request_assign_company_tag> inputs=<{"MiqEvent::miq_event"=>1645000032250575, :miq_event_id=>1645000032250575, "EventStream::event_stream"=>1645000032250575, :event_stream_id=>1645000032250575}> [----] I, [2021-02-03T19:30:09.852192 #2902:6b3c6e8] INFO -- : MiqAeEvent.build_evm_event >> event=<:assigned_company_tag> inputs=<{"MiqEvent::miq_event"=>1645000032250578, :miq_event_id=>1645000032250578, "EventStream::event_stream"=>1645000032250578, :event_stream_id=>1645000032250578}>

Of course I hope somebody has an idea how I can fix this buggy behavior
Kind Regards Roman

Error investigation:


#all_category= $evm.vmdb(:classification).all
#$evm.log("info", "test1: #{all_category.inspect}")

#all_category.each do |category|
#  $evm.log("info", "category: #{category.inspect}")

fix_category = $evm.vmdb(:classification).find_by_id(1645000000000738)
$evm.log("info", "fix: #{fix_category.inspect}")
children = fix_category.children

#children.each do |child|
#$evm.log("info", "ćhild: #{child.inspect}")

fix_tag = $evm.vmdb(:classification).find_by_id(1645000000000769)
$evm.log("info", "fix tag: #{fix_tag.inspect}")
$evm.log("info", "fix tag name #{}")

Investigation in vmdb:

ssh auf MIQHOST
psql -U postgres
\c vmdb_production

vmdb_production=# SELECT * FROM classifications WHERE id = '1645000000000769';
        id        | description  | icon | read_only | syntax | single_value | example_text |      tag_id      |    parent_id     | show | default | perf_by_tag 
 1645000000000769 | Application  |      | f         | string | f            |              | 1645000000000765 | 1645000000000738 | t    |         | 

vmdb_production=# SELECT * FROM tags WHERE id = '1645000000000765';
 id | name 
(0 rows)

vmdb_production=# SELECT * FROM tags WHERE id = '1645000000000766';
        id        |              name              
 1645000000000766 | /managed/services/application
(1 row)


the entry tag_id in table classifications points to a wrong entry in the table tags 
the id 1645000000000765 is not present in the table tags, thats causing the error
tag_id in table classifications has to be 1645000000000766


SQL in vmdb_production: UPDATE classifications SET tag_id = '1645000000000766' WHERE id = '1645000000000769';

Good troubleshooting and analysis, glad it’s fixed now :+1: