Animation Problem

I have a problem with animating a weapon for my character. The problem is that at some point when I try to rotate the arm, which holds the weapon, up (from the left and right view) the weapon rotates 180 degrees by the x-axis. The model’s hand remains unrotated.

For example there is a man holding a spear in his right hand and when he moves his arm upwards, because of victory or something, the weapon flips and becomes a javelin.

I started noticing the rotation right after using the dopesheet, but I think the problem is that I might have used a hotkey.

The weapon (which is a cylinder for testing), is attached to the model’s hand with a (Child Of) constraint.

The problem also affects other projects, but not the ones that I have made a backup of. I don’t want to use the backed up files because they lack some animations that took a lot of hard work. Reinstalling blender didn’t fix it.

I am somewhat new to blender and this is my first human model. Also, my English isn’t very good, since it is not my native language.

Any help would be appreciated.

I can only guess,can you post the blend?
A key frame or constraint on the weapon or it is parented to something. a loop in the parents…

I found out that the problem was that I had made the weapon a (Child Of) constraint of the arm’s hand mesh, which made it rotate at a specific point for some reason. Now, since you made me check the constraints again (I had partially given up on that), it turns out that all I had to do was make the weapon a constraint of the mesh’s armature. Now I know that the complication is actually quite simple to bring forth. Since no one seems to have met something like this, I hope that newbies (such as myself) can fix it if it happens.