Ad Widget

Collapse

Cannot inherit item with key "X" of template "Y" to host "Z", because an item with...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rvanlieshout
    Junior Member
    • Sep 2020
    • 5

    #1

    Cannot inherit item with key "X" of template "Y" to host "Z", because an item with...

    Hi,

    I'm trying to link a template to an other template used by several hosts and it complaints about a key already exists, but it doesn't.

    The message: Cannot inherit item with key "X" of template "Y" to host "Z", because an item with the same key is already inherited from template "Y".

    Without pasting the full configuration yet it's notable that:

    1. X is an item with key 'conntrack_stats[expect_new]'
    2. Y is the name of the parent template named 'Template OS Linux'
    3. Z is a random host that already has Template OS Linux assigned
    4. Key X is from a template named 'Template Network Performance Contract' which I'm going to add to 'Template OS Linux'
    5. Nothing (other than this template) has an item with key 'conntrack_stats[expect_new]'
    6. I'm perfectly able to add the template 'Template Network Performance Contract' directly to host Z

    What works:

    * Host Z
    * Template Y
    * Add template 'Template Network Performance Contract'

    What does not work:

    * Template Y
    * Add template 'Template Network Performance Contract'

    So far

    For some reason it tries to add the item twice within the same action (the update template action). I've verified that there is no item with the key 'conntrack_stats[expect_new]' present in the items table. I've also verified the transaction performs an insert and fails later on.

    I was unable to find any template related to Y that could create a circular reference.

    Would anybody here have suggestions in how to debug this?

  • rvanlieshout
    Junior Member
    • Sep 2020
    • 5

    #2
    This seems to be a bug in CItemGeneral#getInheritChunks. I found out that it was simply trying to insert items twice and that was caused by having items in multiple chunks. I edited that method and changed self::INHERIT_CHUNK_SIZE to 3000.

    It's all inserted now without failures. I might take the time to try to write a bug report for this

    Comment

    • brian.lloyd
      Junior Member
      • May 2024
      • 1

      #3
      Thank you, we've been trying to figure out how to get around this error for a while now. Increasing this value seems to have solved it.

      Comment

      Working...