usebruno/bruno · warning · Error

packages must be a non-empty array

Error message

packages must be a non-empty array

What it means

renderer:install-postman-packages requires packages to be a non-empty array. Throws when Array.isArray(packages) is false or its length is 0.

Source

Thrown at packages/bruno-electron/src/ipc/collection.js:2442

      const result = await postmanToBruno(postmanCollection, {
        useWorkers: true,
        // preserve scripts without any pm.* -> bru.* translation
        preserveScripts: !!options.preserveScripts
      });

      return result;
    } catch (error) {
      console.error('Error converting Postman to Bruno:', error);
      return Promise.reject(error);
    }
  });

  ipcMain.handle('renderer:install-postman-packages', async (_event, collectionPathname, packages) => {
    if (typeof collectionPathname !== 'string' || !collectionPathname) {
      throw new Error('collectionPathname is required');
    }
    if (!Array.isArray(packages) || packages.length === 0) {
      throw new Error('packages must be a non-empty array');
    }
    if (!fs.existsSync(collectionPathname) || !fs.statSync(collectionPathname).isDirectory()) {
      throw new Error(`Collection path does not exist: ${collectionPathname}`);
    }

    const invalid = packages.filter((p) => !isValidNpmPackageName(p));
    if (invalid.length > 0) {
      throw new Error(`Invalid package name(s): ${invalid.join(', ')}`);
    }

    await waitForShellEnv();
    return runNpmInstall({ collectionPath: collectionPathname, packages });
  });

  ipcMain.handle('renderer:get-collection-json', async (event, collectionPath) => {
    let variables = {};
    let name = '';
    const getBruFilesRecursively = async (dir) => {

View on GitHub (pinned to 9bdd81c7bd)

Solutions

  1. Pass an array with at least one package name string.
  2. Skip the install step entirely when the conversion yields no packages.
  3. Verify the conversion result shape before forwarding to install.
Defensive patterns

Strategy: validation

Validate before calling

if (!Array.isArray(packages) || packages.length === 0) {
  throw new Error('packages must be a non-empty array');
}

Type guard

/** @param {unknown} p @returns {p is string[]} */
function isNonEmptyStringArray(p) {
  return Array.isArray(p) && p.length > 0 && p.every((x) => typeof x === 'string');
}

Prevention

When it happens

Trigger: Calling renderer:install-postman-packages with packages = [], null, undefined, or a non-array value.

Common situations: Postman conversion detected no npm dependencies; caller passed the deps object instead of the array; field rename mismatch (deps vs packages).

Related errors


AI-assisted analysis of usebruno/bruno@9bdd81c7bd (2026-08-13). Data as JSON: /api/errors/d5dcd9485265da88. Report an issue: GitHub.