alibaba/nacos · error · Error

HTTP error! status: ${response.status}

Error message

HTTP error! status: ${response.status}

What it means

Thrown by the Prompt Detail page's debug SSE stream when the fetch to the prompt-debug endpoint returns a non-2xx HTTP status (response.ok is false). The error string embeds the status code so you can identify whether it is an auth, client, or server problem.

Source

Thrown at console-ui/src/pages/AI/PromptDetail/PromptDetail.js:1090

      const tokenObj = JSON.parse(token);
      accessToken = tokenObj.accessToken || '';
    } catch (e) {
      // ignore
    }

    fetch(url, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        Accept: 'text/event-stream',
        ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}),
        ...(accessToken ? { AccessToken: accessToken } : {}),
      },
      body: JSON.stringify(payload),
    })
      .then(response => {
        if (!response.ok) {
          throw new Error(`HTTP error! status: ${response.status}`);
        }

        const reader = response.body.getReader();
        const decoder = new TextDecoder();
        let buffer = '';

        const readStream = () => {
          reader
            .read()
            .then(({ done, value }) => {
              if (done) {
                this.setState({ debugging: false });
                return;
              }

              buffer += decoder.decode(value, { stream: true });
              const lines = buffer.split('\n');
              buffer = lines.pop() || '';

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Check the embedded status code: 401/403 means re-authenticate in the console; 400 means fix the prompt payload; 5xx means inspect server logs.
  2. Verify the access token (tokenObj.accessToken) is present and not expired before debugging.
  3. Confirm the Nacos server has the AI prompt debug endpoint enabled and the model backend configured.
  4. Open the browser network tab to read the response body of the failing POST for the server-side error detail.

Example fix

// before
if (!response.ok) {
  throw new Error(`HTTP error! status: ${response.status}`);
}

// after
if (!response.ok) {
  const body = await response.text();
  throw new Error(`Prompt debug failed (${response.status}): ${body}`);
}
Defensive patterns

Strategy: try-catch

Validate before calling

function buildHeaders(token) {
  let accessToken = '';
  try { accessToken = JSON.parse(token).accessToken || ''; } catch {}
  if (!accessToken) throw new Error('Missing access token; please re-login');
  return { 'Content-Type': 'application/json', Accept: 'text/event-stream', Authorization: `Bearer ${accessToken}`, AccessToken: accessToken };
}

Try / catch

.then(async response => {
  if (!response.ok) {
    const body = await response.text();
    this.setState({ debugging: false, debugError: `Prompt debug failed (${response.status}): ${body}` });
    return;
  }
  // ...read stream
}).catch(error => this.setState({ debugging: false, debugError: error.message }));

Prevention

When it happens

Trigger: Clicking 'debug' on a prompt whose server-side debug endpoint rejects the request. Common status causes: 401/403 (missing or expired access token), 400 (malformed prompt payload), 404 (endpoint not deployed), 500 (model backend or pipeline error).

Common situations: Access token expired in the console session, the AI pipeline/plugin not enabled on the server, the upstream LLM provider unreachable, or the prompt references an undeployed model.

Related errors


AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14). Data as JSON: /api/errors/d233125023012ef4. Report an issue: GitHub.