upstash/context7 · info

No documentation found for: "${query}"

Error message

No documentation found for: "${query}"

What it means

Library context was fetched without error, but codeSnippets and infoSnippets are both empty (total === 0), so nothing can be rendered for the query. The spinner branch (line 174) warns; exitCode remains unset — a no-results outcome, not an API failure.

Source

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

  if (ctx.error) {
    if (ctx.redirectUrl) {
      spinner?.warn("Library has been redirected");
      if (!spinner) log.warn("Library has been redirected");
      log.info(`New ID: ${pc.cyan(ctx.redirectUrl)}`);
      log.info(`Run: ${pc.cyan(`ctx7 docs "${ctx.redirectUrl}" "${query}"`)}`);
      process.exitCode = 1;
      return;
    }

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

  const total = (ctx.codeSnippets?.length || 0) + (ctx.infoSnippets?.length || 0);
  if (total === 0) {
    spinner?.warn(`No documentation found for: "${query}"`);
    if (!spinner) log.warn(`No documentation found for: "${query}"`);
    return;
  }

  spinner?.stop();

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

  log.blank();

  if (ctx.codeSnippets) {
    for (const snippet of ctx.codeSnippets) {
      log.plain(pc.bold(snippet.codeTitle));
      if (snippet.codeDescription) log.dim(snippet.codeDescription);
      log.blank();

View on GitHub (pinned to 5284672feb)

Solutions

  1. Broaden the query: 'authentication' instead of 'csrf token rotation in edge middleware'
  2. Use the library's own terminology from its official docs
  3. Search the library first (`context7 docs "<lib>" search`) to confirm which docs are indexed
  4. Check the docs on context7.com to see whether the topic exists at all

Example fix

# before
context7 docs "/websites/nextjs" "useTransition underwater basket weaving"

# after
context7 docs "/websites/nextjs" "useTransition streaming"
Defensive patterns

Strategy: validation

Validate before calling

// before scripting against a topic, verify snippets exist
const ctx = await fetchContext(library, query);
const total = (ctx.codeSnippets?.length || 0) + (ctx.infoSnippets?.length || 0);
if (total === 0) { console.error(`no coverage for "${query}" — broaden terms`); process.exitCode = 1; }

Type guard

function hasSnippets(ctx: { codeSnippets?: unknown[]; infoSnippets?: unknown[] }): boolean {
  return (ctx.codeSnippets?.length ?? 0) + (ctx.infoSnippets?.length ?? 0) > 0;
}

Prevention

When it happens

Trigger: Asking for a topic the library's indexed docs do not cover: overly narrow queries, version-specific features absent from current docs, terminology that does not match the documentation vocabulary, or libraries whose pages contain no extractable snippets.

Common situations: Bleeding-edge APIs before documentation catches up; niche/edge-case topics; queries phrased as tasks ('build a login form') instead of doc topics ('authentication').

Related errors


AI-assisted analysis of upstash/context7@5284672feb (2026-08-18). Data as JSON: /api/errors/bdad0d530b65d753. Report an issue: GitHub.