{"record":{"id":"53a38350a7b6b422","repo":"QuantumNous/new-api","slug":"http-response-status-response-statustext","errorCode":null,"errorMessage":"HTTP ${response.status}: ${response.statusText}","messagePattern":"HTTP (.+?): (.+?)","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"web/src/features/channels/components/dialogs/ollama-models-dialog.tsx","lineNumber":264,"sourceCode":"\n    try {\n      const authHeaders = await getFreshAuthHeaders()\n      const response = await fetch('/api/channel/ollama/pull/stream', {\n        method: 'POST',\n        credentials: 'include',\n        headers: {\n          ...authHeaders,\n          Accept: 'text/event-stream',\n        },\n        body: JSON.stringify({\n          channel_id: channelId,\n          model_name: pullName.trim(),\n        }),\n        signal: controller.signal,\n      })\n\n      if (!response.ok || !response.body) {\n        throw new Error(`HTTP ${response.status}: ${response.statusText}`)\n      }\n\n      const reader = response.body.getReader()\n      const decoder = new TextDecoder()\n      let buffer = ''\n\n      while (true) {\n        const { done, value } = await reader.read()\n        if (done) break\n\n        buffer += decoder.decode(value, { stream: true })\n        const lines = buffer.split('\\n')\n        buffer = lines.pop() || ''\n\n        for (const line of lines) {\n          if (!line.startsWith('data: ')) continue\n          const eventData = line.slice(6)\n          if (!eventData) continue","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/QuantumNous/new-api/blob/e2c7aa7b102c2075eae2377df3508658d45e88dc/web/src/features/channels/components/dialogs/ollama-models-dialog.tsx#L246-L282","documentation":"Thrown by the Ollama model-pull dialog when the streaming response to its fetch is not ok or has no body. The request posts channel_id and model_name to a SSE endpoint with Accept: text/event-stream; any non-2xx status (or missing body) aborts before the reader loop starts, producing this HTTP status string.","triggerScenarios":"Submitting a model pull where the backend returns 4xx/5xx: unknown channel_id, model_name blank after trim, upstream Ollama server unreachable, model not found in the registry, or the long-lived request being killed by a proxy (502/504).","commonSituations":"Ollama host in the channel config wrong or down; reverse proxy (nginx) buffering/timing out SSE; model name typo so the registry returns 404; admin session expired giving 401; channel key invalid giving 403.","solutions":["Match the status: 401/403 → re-login/fix channel key; 404 → wrong endpoint or model name; 502/504 → proxy timeout or Ollama host down","Verify the Ollama server in the channel settings is reachable from the backend (curl the Ollama /api/tags from the backend host)","Increase proxy read timeout / disable buffering for the SSE route if pulls are long","Retry with the exact model tag from `ollama list` on the target host"],"exampleFix":"// before\nif (!response.ok || !response.body) {\n  throw new Error(`HTTP ${response.status}: ${response.statusText}`)\n}\n// after - include the response body message when present\nif (!response.ok || !response.body) {\n  let detail = `${response.status}: ${response.statusText}`\n  try {\n    const body = await response.json()\n    if (body?.message) detail = `${detail} - ${body.message}`\n  } catch { /* body not JSON */ }\n  throw new Error(detail)\n}","handlingStrategy":"try-catch","validationCode":"const name = pullName.trim()\nif (!name) { toast.error(t('Model name is required')); return }\nif (!channelId) { toast.error(t('Channel is not selected')); return }","typeGuard":null,"tryCatchPattern":"try {\n  const response = await fetch(url, { headers: { ...authHeaders, Accept: 'text/event-stream' }, body: JSON.stringify({ channel_id: channelId, model_name: name }), signal: controller.signal })\n  if (!response.ok || !response.body) {\n    let detail = `HTTP ${response.status}: ${response.statusText}`\n    try { const b = await response.json(); if (b?.message) detail += ` - ${b.message}` } catch {}\n    throw new Error(detail)\n  }\n  // reader loop\n} catch (error) {\n  toast.error(error instanceof Error ? error.message : 'Pull failed')\n}","preventionTips":["Trim and require a non-empty model name before opening the stream","Abort the fetch via AbortController when the dialog closes to avoid orphan streams","Configure the reverse proxy with SSE-friendly timeouts (proxy_read_timeout, no buffering)"],"tags":["http-error","sse","ollama","streaming","fetch"],"backgroundTag":null,"analyzedSha":"e2c7aa7b102c2075eae2377df3508658d45e88dc","analyzedAt":"2026-08-15T10:35:18.111Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}