upstash/context7 · warning

No libraries found matching

Error message

No libraries found matching "${library}"

What it means

Warning from `ctx7 docs <library>` (resolveCommand) when the Context7 resolve API returns zero results for the given library name. The command exits gracefully (exit code unchanged) instead of failing, telling the user no library matched.

Solutions

  1. Simplify or correct the library query string
  2. Search context7.com to find the exact catalog name
  3. Try the npm/package name instead of the brand name
  4. Use a library ID directly if already known

Example fix

// before
ctx7 docs react-router-dom-v6-hooks
// after
ctx7 docs react-router
Defensive patterns

Strategy: validation

Validate before calling

if (!library || library.trim().length === 0) { console.error('Library name required'); process.exit(1); }

Type guard

const hasResults = (d: { results?: unknown[] }): d is { results: unknown[] } => Array.isArray(d.results) && d.results.length > 0;

Try / catch

if (!hasResults(data)) { spinner?.warn(`No libraries found matching "${library}"`); return; }

Prevention

When it happens

Trigger: resolveLibraryId API returns data.results empty or undefined — the library query string matched nothing in the Context7 catalog.

Common situations: Misspelled or overly specific library name; package name differs from Context7's catalog name; private/unlisted library not in the index.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of upstash/context7@4416fb855b (2026-09-16). Data as JSON: /api/errors/35cc3dc7c2020823. Report an issue: GitHub.

Appendix: source

Thrown at packages/cli/src/commands/docs.ts:74

  let data;
  try {
    data = await resolveLibrary(library, query, accessToken);
  } catch (err) {
    spinner?.fail(`Error: ${err instanceof Error ? err.message : String(err)}`);
    if (!spinner) log.error(err instanceof Error ? err.message : String(err));
    process.exitCode = 1;
    return;
  }

  if (data.error) {
    spinner?.fail(data.message || data.error);
    if (!spinner) log.error(data.message || data.error);
    process.exitCode = 1;
    return;
  }

  if (!data.results || data.results.length === 0) {
    spinner?.warn(`No libraries found matching "${library}"`);
    if (!spinner) log.warn(`No libraries found matching "${library}"`);
    return;
  }

  const results = data.results;

  spinner?.stop();

  if (options.json) {
    console.log(JSON.stringify(results, null, 2));
    return;
  }

  log.blank();

  if (data.searchFilterApplied) {
    log.warn(
      "Your results only include libraries matching your teamspace's library filters. To adjust quality thresholds or blocked libraries, update your filters at https://context7.com/dashboard?tab=policies"

View on GitHub (pinned to 4416fb855b)