usebruno/bruno · error · Error

collection: already exists and is not empty

Error message

collection: ${dirPath} already exists and is not empty

What it means

Error "collection: ${dirPath} already exists and is not empty" thrown in usebruno/bruno.

Solutions

  1. Choose an empty or new directory for the collection.
  2. Empty the target directory if it is safe to do so.

When it happens

Trigger: Thrown at packages/bruno-electron/src/ipc/collection.js:204 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/b828d83b11c50880. Report an issue: GitHub.

Appendix: source

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

  }

  return envFilePath;
};

const registerRendererEventHandlers = (mainWindow, watcher) => {
  // create collection
  ipcMain.handle(
    'renderer:create-collection',
    async (event, collectionName, collectionFolderName, collectionLocation, options = {}) => {
      try {
        const format = options.format || DEFAULT_COLLECTION_FORMAT;
        collectionFolderName = sanitizeName(collectionFolderName);
        const dirPath = path.join(collectionLocation, collectionFolderName);
        if (fs.existsSync(dirPath)) {
          const files = fs.readdirSync(dirPath);

          if (files.length > 0) {
            throw new Error(`collection: ${dirPath} already exists and is not empty`);
          }
        }

        if (!validateName(path.basename(dirPath))) {
          throw new Error(`collection: invalid pathname - ${dirPath}`);
        }

        if (!fs.existsSync(dirPath)) {
          await createDirectory(dirPath);
        }

        const uid = generateUidBasedOnHash(dirPath);
        let brunoConfig = {
          version: '1',
          name: collectionName,
          type: 'collection',
          ignore: ['node_modules', '.git']
        };

View on GitHub (pinned to 9bdd81c7bd)