You can't use GameTooltip:SetHyperlink with caged battle pets. So, you need to check whether the link you're working with is for a caged battle pet, and use a different method to display those:
Code:
-- You must set the GameTooltip's position first, even for battle pets:
GameTooltip:SetOwner(YOUR_FRAME_HERE, "ANCHOR_TOPLEFT")
-- Check the link type:
if strmatch(link, "|Hbattlepet:") then
-- Battle pet link
local _, speciesID, level, breedQuality, maxHealth, power, speed, name = strsplit(":", link)
BattlePetToolTip_Show(tonumber(speciesID), tonumber(level), tonumber(breedQuality), tonumber(maxHealth), tonumber(power), tonumber(speed), name)
else
-- Other kind of link, OK to use GameTooltip
GameTooltip:SetHyperlink(link)
end