{"record":{"id":"808d5f30e8bc6d15","repo":"usebruno/bruno","slug":"environment-name-already-exists","errorCode":null,"errorMessage":"Environment \"${name}\" already exists","messagePattern":"Environment \"(.+?)\" already exists","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/store/workspace-environments.js","lineNumber":138,"sourceCode":"    }\n  }\n\n  async createGlobalEnvironment(workspacePath, { uid, name, variables, color }) {\n    try {\n      if (!workspacePath) {\n        throw new Error('Workspace path is required');\n      }\n\n      const environmentsDir = this.getEnvironmentsDir(workspacePath);\n\n      if (!fs.existsSync(environmentsDir)) {\n        await createDirectory(environmentsDir);\n      }\n\n      const environmentFilePath = this.getEnvironmentFilePath(workspacePath, name);\n\n      if (fs.existsSync(environmentFilePath)) {\n        throw new Error(`Environment \"${name}\" already exists`);\n      }\n\n      const environment = {\n        name: name,\n        variables: variables || [],\n        color\n      };\n\n      if (this.envHasSecrets(environment)) {\n        environmentSecretsStore.storeEnvSecrets(workspacePath, environment);\n      }\n\n      const content = await stringifyEnvironment(environment, { format: 'yml' });\n      await writeFile(environmentFilePath, content);\n\n      return {\n        uid: generateUidBasedOnHash(environmentFilePath),\n        name,","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/store/workspace-environments.js#L120-L156","documentation":"Error \"Environment \"${name}\" already exists\" thrown in usebruno/bruno.","triggerScenarios":"Thrown at packages/bruno-electron/src/store/workspace-environments.js:138 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pick a different environment name.","Delete or rename the existing environment first."],"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"}