[apm_package_id_from_key attachments]
and see what it returns. It apparently is returning 0 which seems wrong unless attachements isn't installed or someting.