{"record":{"id":"94b4ebc7ed6211a5","repo":"vectordotdev/vector","slug":"source-search-is-unavailable","errorCode":null,"errorMessage":"${source} search is unavailable.","messagePattern":"(.+?) search is unavailable\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"website/assets/js/search.tsx","lineNumber":137,"sourceCode":"      const subResult = data.sub_results[0];\n      const url = subResult?.url ?? data.url;\n\n      return {\n        category: pagefindCategory(url),\n        content: subResult?.excerpt ?? data.excerpt ?? \"\",\n        title: subResult?.title ?? data.meta.title ?? data.url,\n        url\n      };\n    })\n  );\n};\n\nconst searchResults = async (query: string): Promise<PagefindHit[]> => {\n  const recoverResults = async (results: Promise<PagefindHit[]>, source: string) => {\n    try {\n      return await results;\n    } catch (error) {\n      console.warn(`${source} search is unavailable.`, error);\n      return [];\n    }\n  };\n  const [exactResults, rankedResults] = await Promise.all([\n    recoverResults(exactSearchResults(query), \"Exact\"),\n    recoverResults(pagefindResults(query), \"Pagefind\")\n  ]);\n  const exactPages = new Set(exactResults.map((result) => result.url.split(\"#\")[0]));\n  const otherResults = rankedResults.filter((result) => !exactPages.has(result.url.split(\"#\")[0]));\n\n  return [...exactResults, ...otherResults].slice(0, 10);\n};\n\nconst CommandIcon: React.FC = ({ children }) => {\n  return (\n    <svg width=\"15\" height=\"15\">\n      <g fill=\"none\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"1.2\">\n        {children}","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/website/assets/js/search.tsx#L119-L155","documentation":"On the Vector website, searchResults() runs two searches in parallel (Exact and Pagefind). recoverResults() wraps each promise so that if one search backend throws, it logs `${source} search is unavailable.` via console.warn and returns an empty array instead of failing the whole search. It is a deliberate graceful-degradation warning, not a thrown exception.","triggerScenarios":"Any website visitor triggering search (exactResults or rankedResults call paths) when the Pagefind index fails to load (missing/broken pagefind assets, offline preview without generated index) or the exact-search backend throws (network failure, corrupted index files).","commonSituations":"Previewing the site locally without running the pagefind index build step; deploying with stale or missing /pagefind assets; CDN/network errors fetching index fragments; JS blocked or older browser failing a fetch.","solutions":["Regenerate the search index for the site build so the /pagefind directory and its assets are deployed","Serve the site over HTTP (not file://) so pagefind can fetch its index fragments","Check the browser console/network tab for the underlying error logged after the warning (404 on pagefind files is the usual culprit)","If running locally, run the full docs build pipeline rather than serving static assets directly"],"exampleFix":"// before\nnpx serve website/assets  # no pagefind index present\n// after\nmake generate-docs && serve the built site output (includes /pagefind assets)","handlingStrategy":"fallback","validationCode":"// Before initializing search, verify the pagefind index is reachable:\nconst ok = await fetch('/pagefind/pagefind.js', { method: 'HEAD' }).then(r => r.ok).catch(() => false);\nif (!ok) console.warn('Pagefind index missing; search will be degraded.');","typeGuard":"function isPagefindHitArray(v: unknown): v is PagefindHit[] { return Array.isArray(v) && v.every(h => typeof h === 'object' && h !== null && 'data' in h); }","tryCatchPattern":"try {\n  const [exact, ranked] = await Promise.all([exactSearchResults(q), pagefindResults(q)]);\n  render(exact, ranked);\n} catch (error) {\n  console.warn('Search is unavailable.', error);\n  render([], []); // empty-state UI instead of crash\n}","preventionTips":["Always build the pagefind index as part of the site build/deploy pipeline","Smoke-test /pagefind assets in deploy checks","Serve the site over HTTP(S), never file://","Render an explicit 'search unavailable' empty state instead of a blank results area"],"tags":["javascript","search","frontend"],"backgroundTag":"missing-dependency","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}