{"record":{"id":"fd3250d3440536f0","repo":"angular/angular-cli","slug":"search-request-failed-with-status-response-statu","errorCode":null,"errorMessage":"Search request failed with status ${response.status} (${response.statusText})","messagePattern":"Search request failed with status (.+?) \\((.+?)\\)","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular/cli/src/commands/mcp/tools/doc-search.ts","lineNumber":141,"sourceCode":"        attributesToRetrieve: [\n          'hierarchy.lvl0',\n          'hierarchy.lvl1',\n          'hierarchy.lvl2',\n          'hierarchy.lvl3',\n          'hierarchy.lvl4',\n          'hierarchy.lvl5',\n          'hierarchy.lvl6',\n          'content',\n          'type',\n          'url',\n        ],\n        hitsPerPage: 10,\n      }),\n      signal: AbortSignal.timeout(5000), // Timeout after 5 seconds\n    });\n\n    if (!response.ok) {\n      throw new Error(\n        `Search request failed with status ${response.status} (${response.statusText})`,\n      );\n    }\n\n    const data = (await response.json()) as { hits: Record<string, unknown>[] };\n\n    return data.hits;\n  }\n\n  return async ({ query, includeTopContent, version }: DocSearchInput) => {\n    let finalSearchedVersion = Math.max(\n      version ?? LATEST_KNOWN_DOCS_VERSION,\n      MIN_SUPPORTED_DOCS_VERSION,\n    );\n\n    let allHits: Record<string, unknown>[] | undefined;\n    try {\n      allHits = await performSearch(query, finalSearchedVersion);","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular/cli/src/commands/mcp/tools/doc-search.ts#L123-L159","documentation":"doc-search's performSearch queries an external Algolia-based Angular docs search API; if the HTTP response status is not ok (4xx/5xx), it throws this error including the status code and status text. It is a transport/response failure, not a query problem per se, and the request has a 5-second timeout.","triggerScenarios":"The remote search API returns 4xx/5xx (rate limiting 429, service outage 5xx, bad request); network proxies or firewalls returning error responses; the search backend endpoint being down or changed.","commonSituations":"Calling doc-search during an Angular docs service outage; corporate proxy intercepting requests; hitting rate limits with many rapid searches; transient network hiccups within the 5s timeout window.","solutions":["Retry the search after a short delay — most failures are transient (429/5xx).","Check the status code in the message: 429 means slow down; 5xx means the service may be down.","Verify network/proxy configuration allows HTTPS requests to the search API endpoint.","Fall back to browsing the official Angular docs directly if the service remains unavailable."],"exampleFix":"// before\nconst results = await performSearch('control flow syntax'); // throws on 5xx\n// after\ntry {\n  const results = await performSearch('control flow syntax');\n} catch (e) {\n  await new Promise((r) => setTimeout(r, 1000));\n  const results = await performSearch('control flow syntax'); // retry once\n}","handlingStrategy":"retry","validationCode":"// pre-check reachability before calling the tool\nconst res = await fetch(searchEndpoint, { method: 'HEAD' }).catch(() => null);\nif (!res || !res.ok) console.warn('doc search API unreachable, status:', res?.status);","typeGuard":null,"tryCatchPattern":"try {\n  const hits = await performSearch(query);\n} catch (e) {\n  if ((e as Error).message.includes('Search request failed with status')) {\n    const status = /status (\\d+)/.exec((e as Error).message)?.[1];\n    if (status === '429' || status?.startsWith('5')) {\n      await new Promise((r) => setTimeout(r, 2000));\n      return performSearch(query); // single retry\n    }\n  }\n  throw e;\n}","preventionTips":["Treat 429/5xx as transient and back off before retrying","Avoid rapid consecutive doc-search calls to stay under rate limits","Check proxy/firewall settings if failures are consistent","Have a fallback of consulting the Angular docs site manually"],"tags":["network","http","search","angular-cli"],"backgroundTag":"http-request-failed","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}