A firearm was discovered after officials detained a juvenile for an outstanding arrest warrant at Carlsbad High School.