{"record":{"id":"d233125023012ef4","repo":"alibaba/nacos","slug":"http-error-status-response-status","errorCode":null,"errorMessage":"HTTP error! status: ${response.status}","messagePattern":"HTTP error! status: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"console-ui/src/pages/AI/PromptDetail/PromptDetail.js","lineNumber":1090,"sourceCode":"      const tokenObj = JSON.parse(token);\n      accessToken = tokenObj.accessToken || '';\n    } catch (e) {\n      // ignore\n    }\n\n    fetch(url, {\n      method: 'POST',\n      headers: {\n        'Content-Type': 'application/json',\n        Accept: 'text/event-stream',\n        ...(accessToken ? { Authorization: `Bearer ${accessToken}` } : {}),\n        ...(accessToken ? { AccessToken: accessToken } : {}),\n      },\n      body: JSON.stringify(payload),\n    })\n      .then(response => {\n        if (!response.ok) {\n          throw new Error(`HTTP error! status: ${response.status}`);\n        }\n\n        const reader = response.body.getReader();\n        const decoder = new TextDecoder();\n        let buffer = '';\n\n        const readStream = () => {\n          reader\n            .read()\n            .then(({ done, value }) => {\n              if (done) {\n                this.setState({ debugging: false });\n                return;\n              }\n\n              buffer += decoder.decode(value, { stream: true });\n              const lines = buffer.split('\\n');\n              buffer = lines.pop() || '';","sourceCodeStart":1072,"sourceCodeEnd":1108,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/console-ui/src/pages/AI/PromptDetail/PromptDetail.js#L1072-L1108","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Check the embedded status code: 401/403 means re-authenticate in the console; 400 means fix the prompt payload; 5xx means inspect server logs.","Verify the access token (tokenObj.accessToken) is present and not expired before debugging.","Confirm the Nacos server has the AI prompt debug endpoint enabled and the model backend configured.","Open the browser network tab to read the response body of the failing POST for the server-side error detail."],"exampleFix":"// before\nif (!response.ok) {\n  throw new Error(`HTTP error! status: ${response.status}`);\n}\n\n// after\nif (!response.ok) {\n  const body = await response.text();\n  throw new Error(`Prompt debug failed (${response.status}): ${body}`);\n}","handlingStrategy":"try-catch","validationCode":"function buildHeaders(token) {\n  let accessToken = '';\n  try { accessToken = JSON.parse(token).accessToken || ''; } catch {}\n  if (!accessToken) throw new Error('Missing access token; please re-login');\n  return { 'Content-Type': 'application/json', Accept: 'text/event-stream', Authorization: `Bearer ${accessToken}`, AccessToken: accessToken };\n}","typeGuard":null,"tryCatchPattern":".then(async response => {\n  if (!response.ok) {\n    const body = await response.text();\n    this.setState({ debugging: false, debugError: `Prompt debug failed (${response.status}): ${body}` });\n    return;\n  }\n  // ...read stream\n}).catch(error => this.setState({ debugging: false, debugError: error.message }));","preventionTips":["Refresh the access token before opening the debug panel.","Surface the response body, not just the status code.","Confirm the AI debug endpoint and model provider are configured server-side."],"tags":["network","sse","prompt","debug","frontend","auth"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}