Uncaught Error when using kaltura-account-entries-export

I’m trying to harvest all the metadata from my Kaltura instance using the Kaltura-account-entries-export script, and I keep getting an error that looks like this:

PHP Fatal error: Uncaught Error: Call to a member function children() on bool in /kaltura-accounts-entries-export/kaltura-entries-export-excel.php:681
Stack trace:
#0 kaltura-accounts-entries-export/kaltura-entries-export-excel.php(147): KalturaContentAnalytics->getEntriesForSubAccount(PID, NAME, SECRET)
#1 kaltura-accounts-entries-export/kaltura-entries-export-excel.php(1032): KalturaContentAnalytics->run(PID, SECRET)
#2 {main}
thrown in kaltura-entries-export-excel.php on line 681

If I don’t retrieve my custom metadata schema, the harvest goes fine. If I do retrieve my custom metadata schema (which is the point of the harvesting) some categories harvest fine, and some return that error.
Any suggestions?