command works interactively but not in cron?

From: paul beard <paulbeard_at_gmail.com>
Date: Sun, 18 Sep 2022 15:49:05 UTC
/usr/sbin/pkg query %o works fine interactively but if I use it to backup a
list of installed pkgs in crontab, it fails:

00 4 * * *      /usr/sbin/pkg query %o > /var/backups/installed.pkgs

Usage: pkg query <query-format> <pkg-name>
       pkg query [-a] <query-format>
       pkg query -F <pkg-name> <query-format>
       pkg query -e <evaluation> <query-format>
       pkg query [-Cgix] <query-format> <pattern> <...>

For more information see 'pkg help query.'

What am I missing here?
-- 
Paul Beard / www.paulbeard.org/