angular/angular-cli · error · Error

Search request failed with status ${response.status} (${resp

Error message

Search request failed with status ${response.status} (${response.statusText})

What it means

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.

Source

Thrown at packages/angular/cli/src/commands/mcp/tools/doc-search.ts:141

        attributesToRetrieve: [
          'hierarchy.lvl0',
          'hierarchy.lvl1',
          'hierarchy.lvl2',
          'hierarchy.lvl3',
          'hierarchy.lvl4',
          'hierarchy.lvl5',
          'hierarchy.lvl6',
          'content',
          'type',
          'url',
        ],
        hitsPerPage: 10,
      }),
      signal: AbortSignal.timeout(5000), // Timeout after 5 seconds
    });

    if (!response.ok) {
      throw new Error(
        `Search request failed with status ${response.status} (${response.statusText})`,
      );
    }

    const data = (await response.json()) as { hits: Record<string, unknown>[] };

    return data.hits;
  }

  return async ({ query, includeTopContent, version }: DocSearchInput) => {
    let finalSearchedVersion = Math.max(
      version ?? LATEST_KNOWN_DOCS_VERSION,
      MIN_SUPPORTED_DOCS_VERSION,
    );

    let allHits: Record<string, unknown>[] | undefined;
    try {
      allHits = await performSearch(query, finalSearchedVersion);

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Retry the search after a short delay — most failures are transient (429/5xx).
  2. Check the status code in the message: 429 means slow down; 5xx means the service may be down.
  3. Verify network/proxy configuration allows HTTPS requests to the search API endpoint.
  4. Fall back to browsing the official Angular docs directly if the service remains unavailable.

Example fix

// before
const results = await performSearch('control flow syntax'); // throws on 5xx
// after
try {
  const results = await performSearch('control flow syntax');
} catch (e) {
  await new Promise((r) => setTimeout(r, 1000));
  const results = await performSearch('control flow syntax'); // retry once
}
Defensive patterns

Strategy: retry

Validate before calling

// pre-check reachability before calling the tool
const res = await fetch(searchEndpoint, { method: 'HEAD' }).catch(() => null);
if (!res || !res.ok) console.warn('doc search API unreachable, status:', res?.status);

Try / catch

try {
  const hits = await performSearch(query);
} catch (e) {
  if ((e as Error).message.includes('Search request failed with status')) {
    const status = /status (\d+)/.exec((e as Error).message)?.[1];
    if (status === '429' || status?.startsWith('5')) {
      await new Promise((r) => setTimeout(r, 2000));
      return performSearch(query); // single retry
    }
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30). Data as JSON: /api/errors/fd3250d3440536f0. Report an issue: GitHub.