{"record":{"id":"bdad0d530b65d753","repo":"upstash/context7","slug":"no-documentation-found-for-query","errorCode":null,"errorMessage":"No documentation found for: \"${query}\"","messagePattern":"No documentation found for: \"(.+?)\"","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/cli/src/commands/docs.ts","lineNumber":174,"sourceCode":"  if (ctx.error) {\n    if (ctx.redirectUrl) {\n      spinner?.warn(\"Library has been redirected\");\n      if (!spinner) log.warn(\"Library has been redirected\");\n      log.info(`New ID: ${pc.cyan(ctx.redirectUrl)}`);\n      log.info(`Run: ${pc.cyan(`ctx7 docs \"${ctx.redirectUrl}\" \"${query}\"`)}`);\n      process.exitCode = 1;\n      return;\n    }\n\n    spinner?.fail(ctx.message || ctx.error);\n    if (!spinner) log.error(ctx.message || ctx.error);\n    process.exitCode = 1;\n    return;\n  }\n\n  const total = (ctx.codeSnippets?.length || 0) + (ctx.infoSnippets?.length || 0);\n  if (total === 0) {\n    spinner?.warn(`No documentation found for: \"${query}\"`);\n    if (!spinner) log.warn(`No documentation found for: \"${query}\"`);\n    return;\n  }\n\n  spinner?.stop();\n\n  if (options.json) {\n    console.log(JSON.stringify(ctx, null, 2));\n    return;\n  }\n\n  log.blank();\n\n  if (ctx.codeSnippets) {\n    for (const snippet of ctx.codeSnippets) {\n      log.plain(pc.bold(snippet.codeTitle));\n      if (snippet.codeDescription) log.dim(snippet.codeDescription);\n      log.blank();","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/upstash/context7/blob/4416fb855b8f752be735e34f943b5d0762701aad/packages/cli/src/commands/docs.ts#L156-L192","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\nctx7 docs \"some-lib\" \"extremely specific internal function behavior\"\n// after\nctx7 docs \"some-lib\" \"client configuration\"","handlingStrategy":"validation","validationCode":"const total = (ctx.codeSnippets?.length ?? 0) + (ctx.infoSnippets?.length ?? 0);\nif (total === 0) { console.warn(`No docs for \"${query}\"; try broader terms`); return; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["cli","docs","empty-result"],"backgroundTag":"empty-result-set","analyzedSha":"4416fb855b8f752be735e34f943b5d0762701aad","analyzedAt":"2026-09-16T20:28:07.148Z","contentChangedAt":"2026-09-16T20:28:07.148Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}