usebruno/bruno · error · Error

Environment "${newName}" already exists

Error message

Environment "${newName}" already exists

What it means

Error "Environment "${newName}" already exists" thrown in usebruno/bruno.

Source

Thrown at packages/bruno-electron/src/store/workspace-environments.js:219

    }
  }

  async renameGlobalEnvironment(workspacePath, { environmentUid, name: newName }) {
    try {
      if (!workspacePath) {
        throw new Error('Workspace path is required');
      }

      const envFile = this.findEnvironmentFileByUid(workspacePath, environmentUid);

      if (!envFile) {
        throw new Error(`Environment file not found for uid: ${environmentUid}`);
      }

      const newFilePath = this.getEnvironmentFilePath(workspacePath, newName);

      if (fs.existsSync(newFilePath) && newFilePath !== envFile.filePath) {
        throw new Error(`Environment "${newName}" already exists`);
      }

      const environment = await this.parseEnvironmentFile(envFile.filePath, workspacePath);
      const oldName = environment.name;
      environment.name = newName;

      const content = await stringifyEnvironment(environment, { format: 'yml' });
      await writeFile(newFilePath, content);

      if (this.envHasSecrets(environment)) {
        const oldEnv = { name: oldName };
        const secrets = environmentSecretsStore.getEnvSecrets(workspacePath, oldEnv);

        if (secrets && secrets.length > 0) {
          const newEnv = { name: newName, variables: environment.variables };
          environmentSecretsStore.storeEnvSecrets(workspacePath, newEnv);
        }
      }

View on GitHub (pinned to 9bdd81c7bd)

Solutions

  1. Choose a new name that is not already used by another environment.

When it happens

Trigger: Thrown at packages/bruno-electron/src/store/workspace-environments.js:219 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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