{"record":{"id":"0aaf188ea7ff0a43","repo":"dotnet/orleans","slug":"url-failed-with-response-status","errorCode":null,"errorMessage":"${url} failed with ${response.status}","messagePattern":"(.+?) failed with (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"playground/DurableJobsJournaling/DurableJobsJournaling.Web/wwwroot/index.html","lineNumber":104,"sourceCode":"\n  <section class=\"card\" style=\"margin-top:16px\">\n    <h2>Recent workflows</h2>\n    <table><thead><tr><th>Workflow</th><th>Status</th><th>Latency ms</th><th>Retries</th><th>Failures</th><th>Error</th></tr></thead><tbody id=\"recent\"></tbody></table>\n  </section>\n\n  <script>\n    let controlsInitialized = false;\n\n    async function post(url, body) {\n      const options = { method: 'POST' };\n      if (body !== undefined) {\n        options.headers = { 'content-type': 'application/json' };\n        options.body = JSON.stringify(body);\n      }\n\n      const response = await fetch(url, options);\n      if (!response.ok) {\n        throw new Error(`${url} failed with ${response.status}`);\n      }\n\n      await refresh();\n    }\n\n    async function saveSettings() {\n      const response = await fetch('/api/load', {\n        method: 'PUT',\n        headers: { 'content-type': 'application/json' },\n        body: JSON.stringify(settings())\n      });\n      if (!response.ok) {\n        throw new Error(`/api/load failed with ${response.status}`);\n      }\n\n      applySettings(await response.json());\n      await refresh();\n    }","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/playground/DurableJobsJournaling/DurableJobsJournaling.Web/wwwroot/index.html#L86-L122","documentation":"A browser-side Error thrown by the generic post() helper in the DurableJobsJournaling web frontend when any POST (e.g., /api/load/start) returns a non-2xx status. The helper builds fetch options, checks response.ok, and throws a templated message including the URL and status code so the failure is identifiable. The throw propagates to the caller, which is expected to handle it.","triggerScenarios":"Any UI action that calls post(url, body) — starting/stopping load, triggering jobs — and the server returns an error status. The post() helper does not catch, so an unhandled rejection surfaces in the console unless the caller wraps it.","commonSituations":"The load-generation grain threw an exception, the journaling backend is unhealthy, or a request body failed server-side validation. The status code in the message indicates which.","solutions":["Read the status code embedded in the error message to classify the failure (4xx = client/validation, 5xx = server).","Inspect the server logs / response body for the POST URL named in the message.","Wrap post() calls in try/catch at the call site to give the user feedback instead of an unhandled rejection."],"exampleFix":"// before\nconst response = await fetch(url, options);\nif (!response.ok) {\n  throw new Error(`${url} failed with ${response.status}`);\n}\n\n// after (include body for diagnosis)\nconst response = await fetch(url, options);\nif (!response.ok) {\n  const detail = await response.text().catch(() => \"<no body>\");\n  throw new Error(`${url} failed with ${response.status}: ${detail}`);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"async function safePost(url, body) {\n  try {\n    const response = await post(url, body);\n  } catch (err) {\n    console.error(err);\n    showErrorToUser(`Could not perform ${url}: ${err.message}`);\n  }\n}","preventionTips":["Wrap post() calls at the call site so failures become user-facing feedback, not unhandled rejections.","Include the URL and status in the error (already done) for fast triage.","Add retry with backoff for transient 5xx failures."],"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"}