{"record":{"id":"b80eba4b0252b1be","repo":"usebruno/bruno","slug":"a-mock-response-with-this-name-already-exists","errorCode":null,"errorMessage":"A mock response with this name already exists","messagePattern":"A mock response with this name already exists","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bruno-electron/src/app/mock-server/mock-response-store.js","lineNumber":424,"sourceCode":"const listMockResponses = (location) => getMockServerResponses(location);\n\nconst saveMockResponse = (location, response) => {\n  const nextResponse = {\n    ...response,\n    uid: response?.uid || uuidv4()\n  };\n\n  const responses = [...getMockServerResponses(location)];\n\n  const normalizedName = nextResponse.name?.trim().toLowerCase();\n  const currentName = responses.find((item) => item.uid === nextResponse.uid)?.name?.trim().toLowerCase();\n\n  if (normalizedName && normalizedName !== currentName) {\n    const isDuplicate = responses.some((item) => (\n      item.uid !== nextResponse.uid && item.name?.trim().toLowerCase() === normalizedName\n    ));\n    if (isDuplicate) {\n      throw new Error('A mock response with this name already exists');\n    }\n  }\n\n  const index = responses.findIndex((item) => item.uid === nextResponse.uid);\n\n  if (index >= 0) {\n    responses[index] = nextResponse;\n  } else {\n    responses.push(nextResponse);\n  }\n\n  setMockServerResponses(location, responses);\n  return nextResponse;\n};\n\nconst deleteMockResponse = (location, responseUid) => {\n  const responses = getMockServerResponses(location);\n  const nextResponses = responses.filter((item) => item.uid !== responseUid);","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/usebruno/bruno/blob/9bdd81c7bdc57006e5f5ebffb79321a8d979f712/packages/bruno-electron/src/app/mock-server/mock-response-store.js#L406-L442","documentation":"Error \"A mock response with this name already exists\" thrown in usebruno/bruno.","triggerScenarios":"Thrown at packages/bruno-electron/src/app/mock-server/mock-response-store.js:424 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose a unique name for the mock response.","Rename or delete the existing mock response 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"}