Save memory in lookup_ids_by_channel.

Costs a try-catch instead.