usebruno/bruno · error · Error

API key cannot be empty

Error message

API key cannot be empty

What it means

Error "API key cannot be empty" thrown in usebruno/bruno.

Source

Thrown at packages/bruno-electron/src/ipc/ai/index.js:117

};

const registerAiIpc = (mainWindow) => {
  const broadcastStatus = (status) => {
    if (mainWindow?.webContents && !mainWindow.webContents.isDestroyed()) {
      mainWindow.webContents.send('main:ai-status-changed', status);
    }
  };

  ipcMain.handle('renderer:get-ai-status', async () => buildStatus());

  ipcMain.handle('renderer:set-ai-api-key', async (_event, { providerId, apiKey }) => {
    assertKnownProvider(providerId);
    const trimmed = typeof apiKey === 'string' ? apiKey.trim() : '';
    if (!trimmed) {
      if (isOpenAiCompatibleProviderId(providerId)) {
        aiKeyStore.clearKey(providerId);
      } else {
        throw new Error('API key cannot be empty');
      }
    } else {
      aiKeyStore.setKey(providerId, trimmed);
    }
    clearSdkCache();
    const status = buildStatus();
    broadcastStatus(status);
    return status;
  });

  ipcMain.handle('renderer:clear-ai-api-key', async (_event, { providerId }) => {
    assertKnownProvider(providerId);
    aiKeyStore.clearKey(providerId);
    clearSdkCache();
    const status = buildStatus();
    broadcastStatus(status);
    return status;
  });

View on GitHub (pinned to 9bdd81c7bd)

Solutions

  1. Enter a non-empty API key for the provider in Preferences > AI.

When it happens

Trigger: Thrown at packages/bruno-electron/src/ipc/ai/index.js:117 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/72ad2b674d04e95b. Report an issue: GitHub.