angular/angular-cli · warning

Error searching Angular v${finalSearchedVersion} documentati

Error message

Error searching Angular v${finalSearchedVersion} documentation: ${error}

What it means

The Angular docs MCP search tool catches any failure of `performSearch(query, finalSearchedVersion)` (network fetch or index parse) and logs this warning instead of throwing. The handler then may fall back to a stable docs version or return no hits.

Source

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

      );
    }

    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);
    } catch (error) {
      logger.warn(`Error searching Angular v${finalSearchedVersion} documentation: ${error}`);
    }

    // If the initial search for a newer-than-stable version returns no results, it may be because
    // the index for that version doesn't exist yet. In this case, fall back to the latest known
    // stable version.
    if ((!allHits || allHits.length === 0) && finalSearchedVersion > LATEST_KNOWN_DOCS_VERSION) {
      logger.warn(
        `Documentation index for v${finalSearchedVersion} not found or empty. Falling back to v${LATEST_KNOWN_DOCS_VERSION}.`,
      );
      finalSearchedVersion = LATEST_KNOWN_DOCS_VERSION;
      try {
        allHits = await performSearch(query, finalSearchedVersion);
      } catch (error) {
        logger.warn(
          `Error searching fallback Angular v${finalSearchedVersion} documentation: ${error}`,
        );
      }
    }

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Check network connectivity / proxy settings that could block the docs endpoint.
  2. Retry the search; transient fetch errors resolve themselves.
  3. Explicitly search against the latest stable Angular version.
  4. Upgrade the Angular CLI to get updated LATEST_KNOWN_DOCS_VERSION handling.

Example fix

// before
createDocSearchHandler({ version: '20.2.0-next.0' })
// after
createDocSearchHandler({ version: '20.0.0' }) // stable index exists
Defensive patterns

Strategy: fallback

Validate before calling

const reachable = await fetch('https://angular.dev/favicon.ico', { method: 'HEAD' }).then(r => r.ok).catch(() => false);

Type guard

function isHttpError(e: unknown): e is { status: number } { return typeof e === 'object' && e !== null && 'status' in e; }

Try / catch

try { hits = await performSearch(q, v); } catch { logger.warn(`search failed for v${v}`); hits = await performSearch(q, LATEST_KNOWN_DOCS_VERSION).catch(() => []); }

Prevention

When it happens

Trigger: The search index for the requested (possibly newer-than-stable) Angular version is unreachable or fails to parse: network outage, malformed response, or non-existent version index endpoint.

Common situations: Offline development; corporate proxy blocking ai.dev/angular.dev; requesting a just-released Angular version whose docs index is not yet deployed.

Related errors


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