alibaba/nacos · error · Error

HTTP error! status: ${response.status}

Error message

HTTP error! status: ${response.status}

What it means

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.

Source

Thrown at console-ui/src/pages/AI/SkillManagement/SkillOptimizeDialog.js:385

    } catch (e) {
      // eslint-disable-next-line no-console
      console.error('Failed to parse token:', e);
    }

    // Use fetch API for POST request with SSE
    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 = '';
        let currentEventType = 'message'; // Default event type
        let pendingData = null; // Store data when event type comes after data

        const readStream = () => {
          reader
            .read()
            .then(({ done, value }) => {
              if (done) {
                // When stream ends, try to parse optimizedSkill from accumulated content
                // if not already set
                this.setState(prevState => {
                  if (!prevState.optimizedSkill && prevState.streamContent) {
                    let parsedSkill = this.parseOptimizedSkillFromContent(prevState.streamContent);

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Decode the embedded status code: 401/403 -> re-authenticate; 400 -> fix the skill input; 5xx -> inspect server logs for the pipeline/provider error.
  2. Verify the access token is present and fresh before triggering optimize.
  3. Confirm the server has the skill-optimize endpoint and a working model provider configured.
  4. Check the POST response body in the network tab for the precise server-side error message.

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(`Skill optimize failed (${response.status}): ${body}`);
}
Defensive patterns

Strategy: try-catch

Validate before calling

function ensureToken(token) {
  let accessToken = '';
  try { accessToken = JSON.parse(token).accessToken || ''; } catch {}
  if (!accessToken) throw new Error('Missing access token; please re-login');
  return accessToken;
}

Try / catch

.then(async response => {
  if (!response.ok) {
    const body = await response.text();
    this.setState({ streaming: false, loading: false, optimizeError: `Skill optimize failed (${response.status}): ${body}` });
    return;
  }
  // ...read stream
}).catch(error => this.setState({ streaming: false, loading: false, optimizeError: error.message }));

Prevention

When it happens

Trigger: 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).

Common situations: Token expired mid-session, AI skill-optimize pipeline not enabled, upstream LLM provider unreachable or misconfigured, or the skill payload too large.

Related errors


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