{"record":{"id":"783052205a3bf429","repo":"dotnet/orleans","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":"warning","filePath":"playground/ActivationRebalancing/ActivationRebalancing.Frontend/wwwroot/index.html","lineNumber":553,"sourceCode":"\n        // Update line generators with new scale\n        const updatedLineGenerators = colors.map(() => d3.line()\n          .x((d, i) => xScale(i))\n          .y(d => yScale(d)));\n\n        linePaths.each(function (d, i) {\n          d3.select(this)\n            .datum(activationsHistory[i])\n            .attr(\"d\", updatedLineGenerators[i]);\n        });\n      };\n    }\n\n    function fetchData() {\n      fetch('/api/stats/silos')\n        .then(response => {\n          if (!response.ok) {\n            throw new Error(`HTTP error! status: ${response.status}`);\n          }\n          return response.json();\n        })\n        .then(newData => {\n          console.log('Fetched Data:', newData);\n          updateChart(newData);\n        })\n        .catch(error => {\n          console.error('Error fetching grain stats:', error);\n        });\n    }\n\n    setInterval(fetchData, 500);\n    fetchData();\n\n    // Handle window resize for responsiveness\n    let resizeTimeout;\n    window.addEventListener('resize', () => {","sourceCodeStart":535,"sourceCodeEnd":571,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/playground/ActivationRebalancing/ActivationRebalancing.Frontend/wwwroot/index.html#L535-L571","documentation":"This is a browser-side JavaScript Error thrown inside the fetchData() poller in the ActivationRebalancing frontend when the HTTP response to GET /api/stats/silos is not 'ok' (any non-2xx status). fetch() does not reject on HTTP error codes by design, so the code explicitly checks response.ok and throws to route failures into the .catch() handler. The catch only console.errors, so the chart silently stops updating.","triggerScenarios":"The periodic fetch('/api/stats/silos') receives a 4xx/5xx — most commonly 500 because the StatsController threw the 'more than 6 silos' NotSupportedException (error 0), or the controller is unreachable / silo host is down.","commonSituations":"Backend controller threw an exception (see error 0). The Orleans cluster disconnected, the frontend process restarted, or a proxy/gateway returned an error page. CORS or routing misconfiguration returning 404.","solutions":["Open the browser devtools Network tab and inspect the status code + response body of /api/stats/silos to find the real backend error.","If status is 500, check the backend logs — most likely the StatsController hit the 'more than 6 silos' guard; fix the cluster size.","Confirm the frontend is still connected to its Orleans client and that the controller route is reachable (no reverse-proxy path mismatch)."],"exampleFix":"// before\nif (!response.ok) {\n  throw new Error(`HTTP error! status: ${response.status}`);\n}\n\n// after (surface the response body for diagnosis)\nif (!response.ok) {\n  const body = await response.text();\n  throw new Error(`HTTP error! status: ${response.status}: ${body}`);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"async function fetchData() {\n  try {\n    const response = await fetch('/api/stats/silos');\n    if (!response.ok) throw new Error(`HTTP ${response.status}`);\n    updateChart(await response.json());\n  } catch (error) {\n    console.error('Stats fetch failed; retrying next interval', error);\n  }\n}","preventionTips":["Always check response.ok after fetch and include the status/body in the thrown error.","Log or surface failures to the UI so a silent backend breakage is visible.","Keep the polling loop resilient: catch per-iteration so one failure doesn't kill the timer."],"tags":["javascript","fetch","frontend","http","network"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}