{"record":{"id":"9c4a1de81e3c3564","repo":"continuedev/continue","slug":"http-resp-status-resp-statustext","errorCode":null,"errorMessage":"HTTP ${resp.status} ${resp.statusText}","messagePattern":"HTTP \\$\\{resp\\.status\\} \\$\\{resp\\.statusText\\}","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"core/context/providers/URLContextProvider.ts","lineNumber":42,"sourceCode":"    extras: ContextProviderExtras,\n  ): Promise<ContextItem[]> {\n    return await getUrlContextItems(query, extras.fetch);\n  }\n}\n\nexport default URLContextProvider;\n\nexport async function getUrlContextItems(\n  query: string,\n  fetchFn: FetchFunction,\n): Promise<ContextItem[]> {\n  const url = new URL(query);\n  const icon = await fetchFavicon(url);\n  const resp = await fetchFn(url);\n\n  // Check if the response is not OK\n  if (!resp.ok) {\n    throw new Error(`HTTP ${resp.status} ${resp.statusText}`);\n  }\n\n  const html = await resp.text();\n\n  const dom = new JSDOM(html);\n  let reader = new Readability(dom.window.document);\n  let article = reader.parse();\n  const content = article?.content || \"\";\n  const markdown = NodeHtmlMarkdown.translate(\n    content,\n    {},\n    undefined,\n    undefined,\n  );\n\n  const title = article?.title || url.pathname;\n\n  return [","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/core/context/providers/URLContextProvider.ts#L24-L60","documentation":"URLContextProvider.getUrlContextItems fetched the URL and got a non-2xx response; the message includes status code and statusText (e.g. 'HTTP 404 Not Found'). Favicon fetch failures are tolerated earlier, but the main content fetch is strict.","triggerScenarios":"Using the @url provider (or adding a URL to chat) where the server returns 404, 403 (bot blocking), 410, or 5xx.","commonSituations":"Dead links, sites blocking non-browser user agents with 403, paywalled or CDN-protected pages, or typos in the URL.","solutions":["Open the URL in a browser to confirm it exists; fix typos or use an archived copy","If 403, the site likely blocks bots — try a different URL or an RSS/text version","Retry: transient 5xx and rate limits often resolve on a second attempt"],"exampleFix":"// before\nconst resp = await fetchFn(url);\nif (!resp.ok) throw new Error(`HTTP ${resp.status} ${resp.statusText}`);\n// after\nconst resp = await fetchFn(url);\nif (!resp.ok) {\n  if (resp.status >= 500 || resp.status === 429) { /* retry once */ }\n  throw new Error(`HTTP ${resp.status} ${resp.statusText} for ${url}`);\n}","handlingStrategy":"retry","validationCode":"async function checkUrl(url: string): Promise<boolean> {\n  const r = await fetch(url, { method: 'HEAD' }).catch(() => null);\n  return !!r && r.ok;\n}","typeGuard":null,"tryCatchPattern":"for (let i = 0; i < 2; i++) {\n  try { return await getUrlContextItems(url); }\n  catch (e) {\n    if (!/HTTP 5\\d\\d|429/.test(e.message) || i === 1) throw e;\n    await sleep(500 * 2 ** i);\n  }\n}","preventionTips":["Validate/normalize URLs before fetching","Retry 5xx/429 once with backoff","Have a fallback message when a URL can't be read"],"tags":["url","http","fetch","context-provider"],"backgroundTag":"http-404-not-found","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}