Node.js Lighthouse custom Gatherer/Audit – Protocol error (Runtime.evaluate): Object reference chain is too long

I am trying to implement custom audits using the lighthouse library lighthouse and executing some Javascript commands within the Gatherer I get the following error:

Protocol error (Runtime.evaluate): Object reference chain is too long

In detail I have the following Gatherer:

'use strict';
const { Gatherer } = require('lighthouse');

class customGatherer extends Gatherer {
 afterPass(options, loadData) {
    const expression = `window.document.getElementsByTagName('*')`;

    const driver = options.driver;

    return driver.evaluateAsync(expression);
 }
}

module.exports = customGatherer;

That with the expression defined above triggers the problem.
There seems to be too much information and I can’t manage it. I’m testing the command on a web page and it returns 1059 collections (HTMLCollection(1059)).

When I run the lighthouse command to inspect a page, the warning is created and the result cannot be manipulated within the audit:

LH:Runner:warn customGatherer, required by audit my-custom-audit, encountered an error: Protocol error (Runtime.evaluate): Object reference chain is too long +0ms

NB: In the lighthouse log i can see also this error:

 LH:method <= browser ERR:error Runtime.evaluate  +24ms

I need to have a Gatherer that returns all HTMLCollection elements in order to compute them to get all the fonts on the page.
How can I get around this problem?