You're not stupid, this is a subtle error.
PacketTags can only be added once to the packet, hence the error. How to fix it depends on which tag the code is trying to add (twice).
Now, PacketTags (and tags in general) are strange things, because they convey info that is not usually found in a packet. They're metadata that could (or could not) be realistic, so ns-3 tries to use them with a pinch of salt. Examples are:
- Tags added to the packet to convey data inside a node (they're added in a layer, and removed by another layer, but in the same node). Good use and realistic, Operating Systems do add metadata to the packets.
- Tags added to the packet in a node and read by another node. Not realistic and not "right", unless you're trying to do something clearly not realistic. As packet visualisation (NetAnim) or super-detailed statistics (FlowMonitor).
Said so, sometimes the devs do forget to remove a tag, and then they try to add it again. The solution is to check what tag has been added twice and remove it before adding it again., I.e., do something like:
MyTag myTag;
if (packet->PeekPacketTag(myTag))
{
// the tag is here, remove it before adding it back
packet->RemovePacketTag(myTag);
}
Note that you might want to do something more logical, like checking out why the tag was there, what it does contain, and if it makes sense to rewrite it.