usebruno/bruno · error · Error

Could not reach the mock server

Error message

Could not reach the mock server

What it means

Thrown by tryMockResponseRequest after the IPC call 'renderer:mock-server-try-request' returns a result whose success flag is falsy. If result.error exists it is used as the message, otherwise this default text is shown. It indicates the main process mock server handler rejected or never answered the try-request.

Source

Thrown at packages/bruno-app/src/utils/mock-server/mock-responses.js:172

    if (!headers['Content-Type'] && !headers['content-type']) {
      headers['Content-Type'] = 'text/plain';
    }
  }

  return {
    url,
    method,
    headers,
    body: requestBody
  };
};

export const tryMockResponseRequest = async (options) => {
  const payload = buildMockServerTryRequest(options);
  const result = await window.ipcRenderer.invoke('renderer:mock-server-try-request', payload);

  if (!result?.success) {
    throw new Error(result?.error || 'Could not reach the mock server');
  }

  return result;
};

export const resolveMockResponseCollection = ({
  collection,
  instance,
  collections = [],
  activeWorkspace = null
}) => {
  if (collection?.uid) {
    return collection;
  }

  if (instance?.collectionUid) {
    const instanceCollection = collections.find((item) => item.uid === instance.collectionUid);
    if (instanceCollection) {

View on GitHub (pinned to 9bdd81c7bd)

Solutions

  1. Ensure the mock server is started for the current workspace before trying a response.
  2. Save the mock response (so it is persisted and registered) before issuing a try-request.
  3. Restart Bruno to re-initialize the IPC handler if the channel appears dead.
  4. Check main-process logs for the underlying result.error and address that specifically.
Defensive patterns

Strategy: try-catch

Validate before calling

if (!window?.ipcRenderer?.invoke) {
  throw new Error('IPC bridge unavailable');
}

Try / catch

try {
  await tryMockResponseRequest(options);
} catch (err) {
  if (err.message === 'Could not reach the mock server') {
    // start/restart the mock server, save the mock response, then retry once
  }
  throw err;
}

Prevention

When it happens

Trigger: Invoking tryMockResponseRequest({url, method, headers, body}) when the backend mock server is not running, the route matches no registered mock, the IPC handler errored, or result came back undefined/null.

Common situations: Mock server not started for the workspace, mock matchings not yet saved/persisted, IPC channel name changed after an Electron/Bruno update, or a backend crash during the try-request.

Related errors


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