{"record":{"id":"69a0ba2d9a660c0f","repo":"alibaba/nacos","slug":"http-error-status-response-status-69a0ba","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/SkillManagement/SkillOptimizeDialog.js","lineNumber":385,"sourceCode":"    } catch (e) {\n      // eslint-disable-next-line no-console\n      console.error('Failed to parse token:', e);\n    }\n\n    // Use fetch API for POST request with SSE\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        let currentEventType = 'message'; // Default event type\n        let pendingData = null; // Store data when event type comes after data\n\n        const readStream = () => {\n          reader\n            .read()\n            .then(({ done, value }) => {\n              if (done) {\n                // When stream ends, try to parse optimizedSkill from accumulated content\n                // if not already set\n                this.setState(prevState => {\n                  if (!prevState.optimizedSkill && prevState.streamContent) {\n                    let parsedSkill = this.parseOptimizedSkillFromContent(prevState.streamContent);","sourceCodeStart":367,"sourceCodeEnd":403,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/console-ui/src/pages/AI/SkillManagement/SkillOptimizeDialog.js#L367-L403","documentation":"Thrown by the Skill Optimize dialog when the fetch to the skill-optimize SSE endpoint returns a non-2xx status. The dialog streams an optimized skill definition from an LLM; a non-OK response aborts before streaming begins.","triggerScenarios":"Clicking optimize in the Skill Management Optimize dialog and the server rejects the request. Causes: 401/403 (invalid/expired token), 400 (invalid skill payload), 404 (endpoint absent), 500/502 (LLM provider or AI pipeline error).","commonSituations":"Token expired mid-session, AI skill-optimize pipeline not enabled, upstream LLM provider unreachable or misconfigured, or the skill payload too large.","solutions":["Decode the embedded status code: 401/403 -> re-authenticate; 400 -> fix the skill input; 5xx -> inspect server logs for the pipeline/provider error.","Verify the access token is present and fresh before triggering optimize.","Confirm the server has the skill-optimize endpoint and a working model provider configured.","Check the POST response body in the network tab for the precise server-side error message."],"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(`Skill optimize failed (${response.status}): ${body}`);\n}","handlingStrategy":"try-catch","validationCode":"function ensureToken(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 accessToken;\n}","typeGuard":null,"tryCatchPattern":".then(async response => {\n  if (!response.ok) {\n    const body = await response.text();\n    this.setState({ streaming: false, loading: false, optimizeError: `Skill optimize failed (${response.status}): ${body}` });\n    return;\n  }\n  // ...read stream\n}).catch(error => this.setState({ streaming: false, loading: false, optimizeError: error.message }));","preventionTips":["Validate the skill input before optimizing.","Refresh the session token before opening the dialog.","Confirm the server's skill-optimize endpoint and model provider are configured."],"tags":["network","sse","skill","optimize","frontend","auth"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}