Error when registering patients' contacts in a repeat group


I have a problem. When I register an index case patient’s contacts, I get the error below.

Display Condition Error: Error in calculation for /data/caso_index XPath nodeset has more than one node[/data/caso_index[1]/contactos[1]/paciente_adulto_ou_criana[1];/data/caso_index[1]/contactos[2]/paciente_adulto_ou_criana[1]]; cannot convert multiple nodes to a raw value. Refine path expression to match only one node.

I have a question which asks: how many contacts live with you? I dragged this into repeat-count.

If the answer to the question is, for example, 2, I have to register two contacts. What happens is that I register the first contact normally, but when I register the second contact, I get the aforementioned error.

Can you help me understand why this happens?

I think you may actually want the sum() function to support the workflow you are describing, can you see if that behaves as expected?