{"record":{"id":"a37281a88edd3e40","repo":"usebruno/bruno","slug":"environment-environmentname-is-not-a-valid-env","errorCode":null,"errorMessage":"environment: ${environmentName} is not a valid environment name","messagePattern":"environment: (.+?) is not a valid environment name","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/ipc/collection.js","lineNumber":185,"sourceCode":"  return null;\n};\n\nconst validatePathIsInsideCollection = (filePath) => {\n  const collectionPath = findCollectionPathByItemPath(filePath);\n\n  if (!collectionPath) {\n    throw new Error(`Path: ${filePath} should be inside a collection`);\n  }\n};\n\nconst resolveEnvironmentFilePath = (collectionPathname, environmentName, format) => {\n  validatePathIsInsideCollection(collectionPathname);\n\n  const envDirPath = path.join(collectionPathname, 'environments');\n  const envFilePath = path.join(envDirPath, `${environmentName}.${format}`);\n\n  if (path.dirname(path.resolve(envFilePath)) !== path.resolve(envDirPath)) {\n    throw new Error(`environment: ${environmentName} is not a valid environment name`);\n  }\n\n  return envFilePath;\n};\n\nconst registerRendererEventHandlers = (mainWindow, watcher) => {\n  // create collection\n  ipcMain.handle(\n    'renderer:create-collection',\n    async (event, collectionName, collectionFolderName, collectionLocation, options = {}) => {\n      try {\n        const format = options.format || DEFAULT_COLLECTION_FORMAT;\n        collectionFolderName = sanitizeName(collectionFolderName);\n        const dirPath = path.join(collectionLocation, collectionFolderName);\n        if (fs.existsSync(dirPath)) {\n          const files = fs.readdirSync(dirPath);\n\n          if (files.length > 0) {","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/ipc/collection.js#L167-L203","documentation":"Error \"environment: ${environmentName} is not a valid environment name\" thrown in usebruno/bruno.","triggerScenarios":"Thrown at packages/bruno-electron/src/ipc/collection.js:185 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use an environment name with valid characters (no path separators, not reserved)."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9bdd81c7bdc57006e5f5ebffb79321a8d979f712","analyzedAt":"2026-08-13T04:09:25.751Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}