I am going out on a limb here since I can't really understand your description. If by first and second cogs you actually mean the jockey wheels on the deraileur then it sounds like the chain is not routed properly over the jockey wheels. If you really mean cogs (on the cluster) then it sounds like this must be only when shifting between the first and second cogs.
Can you take a picture to clarify?