I have a strange error that only happens sometimes and I can't figure out what is going wrong. I get the following error:
Component ID form_lpm:PODports:PODlocalChargeTable:j_idt1665:j_idt1667:chargeDiv has already been found in the view.
Okay we all know that you can't have duplicate IDs in JSF but that ID above doesn't actually exists! I have something like this:
<ui:repeat id="PODport">
<p:dataTable id="PODlocalChargeTable">
<p:columns>
<my:compositeComp/>
</p:columns>
</p:dataTable>
</ui:repeat>
The composite component (my:compositeComp) has an ID chargeDiv in there. So in the error message j_idt1665 is the dynamic ID for the p:columns iteration and j_idt1667 the ID for the composite component.
However in the actual generated HTML we get these IDs (as you would expect): The green counter is for the ui:repeat, the blue one for the dataTable and the orange one is for the p:columns.

At first this page is rendered fine (with the IDs shown above) but when I do an ajax request and update the form I get the error with the duplicate ID. The strange thing is that the counters are removed from that ID. Why is that and what can I do?
I have tried to specify IDs for the p:columns (dynCol) and the composite component (compId) and interestingly I now get pretty much the same error but one of the counters is still in the ID:
<ui:repeat id="PODport">
<p:dataTable id="PODlocalChargeTable">
<p:columns id="dynCol">
<my:compositeComp id="compId"/>
</p:columns>
</p:dataTable>
</ui:repeat>
Component ID form_lpm:PODports:PODlocalChargeTable:dynCol:2:compId:chargeDiv has already been found in the view
I had the problem with two different composite components. The components were basically just something like this:
<p:outputPanel id="chargeDiv">
content
</p:outputPanel>
<p:tooltip for="chargeDiv">
tooltip content
</p:tooltip>
I am using JSF 2.1 (Mojarra 2.1.29-08) and Primefaces 6.1.18
Update: I have done a bit more testing and it is definitely related to the use of composite components. If I have a very simple composite component:
<cc:implementation>
<p:outputPanel id="chargeDiv">
</p:outputPanel>
</cc:implementation>
and I have dynamic columns like
<p:columns var="myvar" value="#{bean.list}" id="dynCol">
<my:compositeComp/>
</p:columns>
I get the error with the duplicate ID. If I use the content of the composite component directly in the p:columns:
<p:columns var="myvar" value="#{bean.list}" id="dynCol">
<p:outputPanel id="chargeDiv">
content
</p:outputPanel>
</p:columns>
then it works fine.