upstash/context7 · warning
No documentation found for
Error message
No documentation found for: "${query}" What it means
When the docs query returns no error but zero snippets (codeSnippets and infoSnippets both empty), queryCommand warns 'No documentation found for: "<query>"' via spinner or log.warn and returns without output. This is the CLI's empty-result guard: the library resolved, but nothing matched the query.
Solutions
- Rephrase the query with broader or alternative keywords and retry
- Verify the library is the intended one and has content (try a generic query like 'getting started')
- If using topic/keyword options, remove or simplify them
Example fix
// before ctx7 docs "some-lib" "extremely specific internal function behavior" // after ctx7 docs "some-lib" "client configuration"
Defensive patterns
Strategy: validation
Validate before calling
const total = (ctx.codeSnippets?.length ?? 0) + (ctx.infoSnippets?.length ?? 0);
if (total === 0) { console.warn(`No docs for "${query}"; try broader terms`); return; } Prevention
- Prefer broad, well-known topic keywords in queries
- Confirm the library has indexed content before deep queries
- Provide fallback queries (progressively broader) when a query returns empty
When it happens
Trigger: Calling `ctx7 docs <libraryId> <query>` where the API returns a ContextResponse with error=false but codeSnippets and infoSnippets are both empty or undefined (total === 0).
Common situations: Overly specific or niche query terms against a sparsely indexed library; querying a library topic the docs do not cover; typo'd topic keywords; newly added library with little indexed content.
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
- Library has been redirected
- No libraries found matching
- No matching skills found for your dependencies
- No skills found in
- searchResult.message || "Try a different description"
AI-assisted analysis of upstash/context7@4416fb855b (2026-09-16).
Data as JSON: /api/errors/bdad0d530b65d753.
Report an issue: GitHub.
Appendix: 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 4416fb855b)