{"record":{"id":"d5dcd9485265da88","repo":"usebruno/bruno","slug":"packages-must-be-a-non-empty-array","errorCode":null,"errorMessage":"packages must be a non-empty array","messagePattern":"packages must be a non-empty array","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"packages/bruno-electron/src/ipc/collection.js","lineNumber":2442,"sourceCode":"      const result = await postmanToBruno(postmanCollection, {\n        useWorkers: true,\n        // preserve scripts without any pm.* -> bru.* translation\n        preserveScripts: !!options.preserveScripts\n      });\n\n      return result;\n    } catch (error) {\n      console.error('Error converting Postman to Bruno:', error);\n      return Promise.reject(error);\n    }\n  });\n\n  ipcMain.handle('renderer:install-postman-packages', async (_event, collectionPathname, packages) => {\n    if (typeof collectionPathname !== 'string' || !collectionPathname) {\n      throw new Error('collectionPathname is required');\n    }\n    if (!Array.isArray(packages) || packages.length === 0) {\n      throw new Error('packages must be a non-empty array');\n    }\n    if (!fs.existsSync(collectionPathname) || !fs.statSync(collectionPathname).isDirectory()) {\n      throw new Error(`Collection path does not exist: ${collectionPathname}`);\n    }\n\n    const invalid = packages.filter((p) => !isValidNpmPackageName(p));\n    if (invalid.length > 0) {\n      throw new Error(`Invalid package name(s): ${invalid.join(', ')}`);\n    }\n\n    await waitForShellEnv();\n    return runNpmInstall({ collectionPath: collectionPathname, packages });\n  });\n\n  ipcMain.handle('renderer:get-collection-json', async (event, collectionPath) => {\n    let variables = {};\n    let name = '';\n    const getBruFilesRecursively = async (dir) => {","sourceCodeStart":2424,"sourceCodeEnd":2460,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/ipc/collection.js#L2424-L2460","documentation":"renderer:install-postman-packages requires packages to be a non-empty array. Throws when Array.isArray(packages) is false or its length is 0.","triggerScenarios":"Calling renderer:install-postman-packages with packages = [], null, undefined, or a non-array value.","commonSituations":"Postman conversion detected no npm dependencies; caller passed the deps object instead of the array; field rename mismatch (deps vs packages).","solutions":["Pass an array with at least one package name string.","Skip the install step entirely when the conversion yields no packages.","Verify the conversion result shape before forwarding to install."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!Array.isArray(packages) || packages.length === 0) {\n  throw new Error('packages must be a non-empty array');\n}","typeGuard":"/** @param {unknown} p @returns {p is string[]} */\nfunction isNonEmptyStringArray(p) {\n  return Array.isArray(p) && p.length > 0 && p.every((x) => typeof x === 'string');\n}","tryCatchPattern":null,"preventionTips":["Skip the install step when conversion detects no dependencies rather than calling with [].","Verify the conversion result shape (deps vs packages) before forwarding."],"tags":["ipc","postman","npm","validation","argument-validation"],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}