GoogleChrome/lighthouse · error · TypeError

Expected array but got ${typeof base}

Error message

Expected array but got ${typeof base}

What it means

Error "Expected array but got ${typeof base}" thrown in GoogleChrome/lighthouse.

Source

Thrown at core/config/config-helpers.js:90

 *        - false: Arrays are concatenated and de-duped by isEqual.
 *    - Objects are recursively merged.
 *    - If the `settings` key is encountered while traversing an object, its arrays are *always*
 *      overridden, not concatenated. (`overwriteArrays` is flipped to `true`)
 *
 * More widely typed than exposed merge() function, below.
 * @param {Object<string, any>|Array<any>|undefined|null} base
 * @param {Object<string, any>|Array<any>} extension
 * @param {boolean=} overwriteArrays
 */
function _mergeConfigFragment(base, extension, overwriteArrays = false) {
  // If the default value doesn't exist or is explicitly null, defer to the extending value
  if (typeof base === 'undefined' || base === null) {
    return extension;
  } else if (typeof extension === 'undefined') {
    return base;
  } else if (Array.isArray(extension)) {
    if (overwriteArrays) return extension;
    if (!Array.isArray(base)) throw new TypeError(`Expected array but got ${typeof base}`);
    const merged = base.slice();
    extension.forEach(item => {
      if (!merged.some(candidate => isEqual(candidate, item))) merged.push(item);
    });

    return merged;
  } else if (typeof extension === 'object') {
    if (typeof base !== 'object') throw new TypeError(`Expected object but got ${typeof base}`);
    if (Array.isArray(base)) throw new TypeError('Expected object but got Array');
    Object.keys(extension).forEach(key => {
      const localOverwriteArrays = overwriteArrays ||
        (key === 'settings' && typeof base[key] === 'object');
      base[key] = _mergeConfigFragment(base[key], extension[key], localOverwriteArrays);
    });
    return base;
  }

  return extension;

View on GitHub (pinned to 9515cd4e58)

Solutions

  1. Pass an array for this config property instead of the current value.
  2. Check the type of the value you supplied; use JSON array syntax, e.g. ["value1", "value2"].

When it happens

Trigger: Thrown during config extension when a base config value that must be merged as an array (e.g. audits or categories) is not an array.

Common situations: See trigger scenarios.


AI-assisted analysis of GoogleChrome/lighthouse@9515cd4e58 (2026-08-13). Data as JSON: /api/errors/4f05f24cfa724bcc. Report an issue: GitHub.