vectordotdev/vector · warning

search is unavailable.

Error message

${source} search is unavailable.

What it means

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.

Solutions

  1. Regenerate the search index for the site build so the /pagefind directory and its assets are deployed
  2. Serve the site over HTTP (not file://) so pagefind can fetch its index fragments
  3. Check the browser console/network tab for the underlying error logged after the warning (404 on pagefind files is the usual culprit)
  4. If running locally, run the full docs build pipeline rather than serving static assets directly

Example fix

// before
npx serve website/assets  # no pagefind index present
// after
make generate-docs && serve the built site output (includes /pagefind assets)
Defensive patterns

Strategy: fallback

Validate before calling

// Before initializing search, verify the pagefind index is reachable:
const ok = await fetch('/pagefind/pagefind.js', { method: 'HEAD' }).then(r => r.ok).catch(() => false);
if (!ok) console.warn('Pagefind index missing; search will be degraded.');

Type guard

function isPagefindHitArray(v: unknown): v is PagefindHit[] { return Array.isArray(v) && v.every(h => typeof h === 'object' && h !== null && 'data' in h); }

Try / catch

try {
  const [exact, ranked] = await Promise.all([exactSearchResults(q), pagefindResults(q)]);
  render(exact, ranked);
} catch (error) {
  console.warn('Search is unavailable.', error);
  render([], []); // empty-state UI instead of crash
}

Prevention

When it happens

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

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

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.


AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16). Data as JSON: /api/errors/94b4ebc7ed6211a5. Report an issue: GitHub.

Appendix: source

Thrown at website/assets/js/search.tsx:137

      const subResult = data.sub_results[0];
      const url = subResult?.url ?? data.url;

      return {
        category: pagefindCategory(url),
        content: subResult?.excerpt ?? data.excerpt ?? "",
        title: subResult?.title ?? data.meta.title ?? data.url,
        url
      };
    })
  );
};

const searchResults = async (query: string): Promise<PagefindHit[]> => {
  const recoverResults = async (results: Promise<PagefindHit[]>, source: string) => {
    try {
      return await results;
    } catch (error) {
      console.warn(`${source} search is unavailable.`, error);
      return [];
    }
  };
  const [exactResults, rankedResults] = await Promise.all([
    recoverResults(exactSearchResults(query), "Exact"),
    recoverResults(pagefindResults(query), "Pagefind")
  ]);
  const exactPages = new Set(exactResults.map((result) => result.url.split("#")[0]));
  const otherResults = rankedResults.filter((result) => !exactPages.has(result.url.split("#")[0]));

  return [...exactResults, ...otherResults].slice(0, 10);
};

const CommandIcon: React.FC = ({ children }) => {
  return (
    <svg width="15" height="15">
      <g fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="1.2">
        {children}

View on GitHub (pinned to bdb87aeaa4)