usebruno/bruno · error · Error

A mock response with this name already exists

Error message

A mock response with this name already exists

What it means

Error "A mock response with this name already exists" thrown in usebruno/bruno.

Source

Thrown at packages/bruno-electron/src/app/mock-server/mock-response-store.js:424

const listMockResponses = (location) => getMockServerResponses(location);

const saveMockResponse = (location, response) => {
  const nextResponse = {
    ...response,
    uid: response?.uid || uuidv4()
  };

  const responses = [...getMockServerResponses(location)];

  const normalizedName = nextResponse.name?.trim().toLowerCase();
  const currentName = responses.find((item) => item.uid === nextResponse.uid)?.name?.trim().toLowerCase();

  if (normalizedName && normalizedName !== currentName) {
    const isDuplicate = responses.some((item) => (
      item.uid !== nextResponse.uid && item.name?.trim().toLowerCase() === normalizedName
    ));
    if (isDuplicate) {
      throw new Error('A mock response with this name already exists');
    }
  }

  const index = responses.findIndex((item) => item.uid === nextResponse.uid);

  if (index >= 0) {
    responses[index] = nextResponse;
  } else {
    responses.push(nextResponse);
  }

  setMockServerResponses(location, responses);
  return nextResponse;
};

const deleteMockResponse = (location, responseUid) => {
  const responses = getMockServerResponses(location);
  const nextResponses = responses.filter((item) => item.uid !== responseUid);

View on GitHub (pinned to 9bdd81c7bd)

Solutions

  1. Choose a unique name for the mock response.
  2. Rename or delete the existing mock response first.

When it happens

Trigger: Thrown at packages/bruno-electron/src/app/mock-server/mock-response-store.js:424 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/b80eba4b0252b1be. Report an issue: GitHub.