In some cases, if you're installing a theme or extension over a Magento instance that previously had a different theme, or already has categories created, you may experience this exception on the frontend.
Usually, to solve it, a reindex of the catalog is required. You can do that by using the following command:
php bin/magento indexer:reindex
More thorough information about the reindexing process can be found in this article: