In Disney's Aladdin, after Aladdin, Abu, and Carpet had just been trapped in the cave, Abu reveals that he stole the lamp back from Jafar. Aladdin tries to read an inscription on the lamp, and Carpet hops over to look at it with curiosity, leaning in to read the text as well (as if Carpet hadn't seen the lamp before). Carpet is surprised by the lamp moving on its own, and after smoke comes shooting out of it, whisks Abu to safety, hiding and peeking out from behind a rock. After the Genie appears and starts talking to them, Carpet also seems to be as confused as Aladdin.
A short time later, the Genie says "Yo, Rug Man! Haven't seen you in a few millennia, give me some tassel!", and the two perform a choreographed handshake, revealing that they know each other (supposedly from ten thousand years ago). Carpet goes for this handshake without hesitation, and clearly knew how to perform it, so Carpet must've done it at least a couple times before.
Clearly Carpet knew the Genie, and had interacted with him several times in the past, so why did he seem to not know about the lamp, and why was he surprised by the Genie's appearance?