ChatGPTNextWeb/NextChat · error · Error

Network response was not ok

Error message

Network response was not ok

What it means

Thrown at app/utils/ms_edge_tts.ts:263 inside MsEdgeTTS.getVoices() when fetch(MsEdgeTTS.VOICES_URL) resolves with response.ok === false. The VOICES_URL is the public Microsoft Edge 'readaloud' voices list endpoint (speech.platform.bing.com/.../voices/list?trustedclienttoken=...). Any non-2xx HTTP status from that endpoint triggers the generic 'Network response was not ok'.

Source

Thrown at app/utils/ms_edge_tts.ts:263

  }

  /**
   * Fetch the list of voices available in Microsoft Edge.
   * These, however, are not all. The complete list of voices supported by this module [can be found here](https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support) (neural, standard, and preview).
   */
  // getVoices(): Promise<Voice[]> {
  //   return new Promise((resolve, reject) => {
  //     axios
  //       .get(MsEdgeTTS.VOICES_URL)
  //       .then((res) => resolve(res.data))
  //       .catch(reject);
  //   });
  // }
  getVoices(): Promise<Voice[]> {
    return fetch(MsEdgeTTS.VOICES_URL)
      .then((response) => {
        if (!response.ok) {
          throw new Error("Network response was not ok");
        }
        return response.json();
      })
      .then((data) => data as Voice[])
      .catch((error) => {
        throw error;
      });
  }

  /**
   * Sets the required information for the speech to be synthesised and inits a new WebSocket connection.
   * Must be called at least once before text can be synthesised.
   * Saved in this instance. Can be called at any time times to update the metadata.
   *
   * @param voiceName a string with any `ShortName`. A list of all available neural voices can be found [here](https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support#neural-voices). However, it is not limited to neural voices: standard voices can also be used. A list of standard voices can be found [here](https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support#standard-voices)
   * @param outputFormat any {@link OUTPUT_FORMAT}
   * @param voiceLocale (optional) any voice locale that is supported by the voice. See the list of all voices for compatibility. If not provided, the locale will be inferred from the `voiceName`
   */

View on GitHub (pinned to defdcdb55d)

Solutions

  1. Check connectivity to https://speech.platform.bing.com from the host and confirm the trustedclienttoken in VOICES_URL is still current.
  2. Wrap getVoices() in a retry with exponential backoff for transient 5xx responses.
  3. Cache the last successful voice list locally so a later fetch failure can fall back instead of throwing.
  4. Surface the actual HTTP status code in the error so the cause (geo-block vs outage vs token) is diagnosable.

Example fix

// before
if (!response.ok) {
  throw new Error("Network response was not ok");
}

// after
if (!response.ok) {
  throw new Error(
    `Edge TTS voices endpoint returned ${response.status} ${response.statusText}`,
  );
}
Defensive patterns

Strategy: retry

Validate before calling

async function voicesEndpointReachable(): Promise<boolean> {
  try {
    const res = await fetch(MsEdgeTTS.VOICES_URL, { method: "HEAD" });
    return res.ok;
  } catch {
    return false;
  }
}

if (!(await voicesEndpointReachable())) {
  throw new Error("Edge TTS voices endpoint unreachable");
}

Type guard

function isOkResponse(res: Response): res is Response & { ok: true } {
  return res.ok;
}

Try / catch

async function getVoicesWithRetry(retries = 3): Promise<Voice[]> {
  for (let attempt = 0; attempt <= retries; attempt++) {
    try {
      return await tts.getVoices();
    } catch (e) {
      if (attempt === retries) throw e;
      await new Promise((r) => setTimeout(r, 2 ** attempt * 500));
    }
  }
  throw new Error("unreachable");
}

Prevention

When it happens

Trigger: Microsoft's endpoint returns 4xx/5xx (transient outage, deprecated token, geo-block); a captive portal / proxy returns a non-2xx intercept page; the request is made from a context where the endpoint is unreachable but fetch still resolves (e.g. corporate firewall returning 403); DNS/SSL issue surfaces as a non-ok response via a proxy layer.

Common situations: Running in a region where the Bing speech endpoint is geo-restricted; the trustedclienttoken changes upstream and the old URL 404s; offline/air-gapped environment; browser CORS preflight rejected with a non-2xx; running behind a transparent proxy that blocks bing.com.

Related errors


AI-assisted analysis of ChatGPTNextWeb/NextChat@defdcdb55d (2026-08-12). Data as JSON: /api/errors/e19cd8bb973f5fda. Report an issue: GitHub.