{"record":{"id":"d611ad0b66f4aec4","repo":"angular/angular-cli","slug":"error-searching-angular-v-finalsearchedversion-d","errorCode":null,"errorMessage":"Error searching Angular v${finalSearchedVersion} documentation: ${error}","messagePattern":"Error searching Angular v(.+?) documentation: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/angular/cli/src/commands/mcp/tools/doc-search.ts","lineNumber":161,"sourceCode":"      );\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);\n    } catch (error) {\n      logger.warn(`Error searching Angular v${finalSearchedVersion} documentation: ${error}`);\n    }\n\n    // If the initial search for a newer-than-stable version returns no results, it may be because\n    // the index for that version doesn't exist yet. In this case, fall back to the latest known\n    // stable version.\n    if ((!allHits || allHits.length === 0) && finalSearchedVersion > LATEST_KNOWN_DOCS_VERSION) {\n      logger.warn(\n        `Documentation index for v${finalSearchedVersion} not found or empty. Falling back to v${LATEST_KNOWN_DOCS_VERSION}.`,\n      );\n      finalSearchedVersion = LATEST_KNOWN_DOCS_VERSION;\n      try {\n        allHits = await performSearch(query, finalSearchedVersion);\n      } catch (error) {\n        logger.warn(\n          `Error searching fallback Angular v${finalSearchedVersion} documentation: ${error}`,\n        );\n      }\n    }","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular/cli/src/commands/mcp/tools/doc-search.ts#L143-L179","documentation":"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.","triggerScenarios":"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.","commonSituations":"Offline development; corporate proxy blocking ai.dev/angular.dev; requesting a just-released Angular version whose docs index is not yet deployed.","solutions":["Check network connectivity / proxy settings that could block the docs endpoint.","Retry the search; transient fetch errors resolve themselves.","Explicitly search against the latest stable Angular version.","Upgrade the Angular CLI to get updated LATEST_KNOWN_DOCS_VERSION handling."],"exampleFix":"// before\ncreateDocSearchHandler({ version: '20.2.0-next.0' })\n// after\ncreateDocSearchHandler({ version: '20.0.0' }) // stable index exists","handlingStrategy":"fallback","validationCode":"const reachable = await fetch('https://angular.dev/favicon.ico', { method: 'HEAD' }).then(r => r.ok).catch(() => false);","typeGuard":"function isHttpError(e: unknown): e is { status: number } { return typeof e === 'object' && e !== null && 'status' in e; }","tryCatchPattern":"try { hits = await performSearch(q, v); } catch { logger.warn(`search failed for v${v}`); hits = await performSearch(q, LATEST_KNOWN_DOCS_VERSION).catch(() => []); }","preventionTips":["Check network/proxy before relying on MCP doc search.","Prefer stable versions over prereleases in queries.","Retry transient failures.","Keep the CLI updated for current docs endpoints."],"tags":["network","documentation-search","mcp"],"backgroundTag":"docs-fetch-failed","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}