{"record":{"id":"35cc3dc7c2020823","repo":"upstash/context7","slug":"no-libraries-found-matching-library","errorCode":null,"errorMessage":"No libraries found matching \"${library}\"","messagePattern":"No libraries found matching \"(.+?)\"","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/cli/src/commands/docs.ts","lineNumber":74,"sourceCode":"  let data;\n  try {\n    data = await resolveLibrary(library, query, accessToken);\n  } catch (err) {\n    spinner?.fail(`Error: ${err instanceof Error ? err.message : String(err)}`);\n    if (!spinner) log.error(err instanceof Error ? err.message : String(err));\n    process.exitCode = 1;\n    return;\n  }\n\n  if (data.error) {\n    spinner?.fail(data.message || data.error);\n    if (!spinner) log.error(data.message || data.error);\n    process.exitCode = 1;\n    return;\n  }\n\n  if (!data.results || data.results.length === 0) {\n    spinner?.warn(`No libraries found matching \"${library}\"`);\n    if (!spinner) log.warn(`No libraries found matching \"${library}\"`);\n    return;\n  }\n\n  const results = data.results;\n\n  spinner?.stop();\n\n  if (options.json) {\n    console.log(JSON.stringify(results, null, 2));\n    return;\n  }\n\n  log.blank();\n\n  if (data.searchFilterApplied) {\n    log.warn(\n      \"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\"","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/upstash/context7/blob/4416fb855b8f752be735e34f943b5d0762701aad/packages/cli/src/commands/docs.ts#L56-L92","documentation":"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.","triggerScenarios":"resolveLibraryId API returns data.results empty or undefined — the library query string matched nothing in the Context7 catalog.","commonSituations":"Misspelled or overly specific library name; package name differs from Context7's catalog name; private/unlisted library not in the index.","solutions":["Simplify or correct the library query string","Search context7.com to find the exact catalog name","Try the npm/package name instead of the brand name","Use a library ID directly if already known"],"exampleFix":"// before\nctx7 docs react-router-dom-v6-hooks\n// after\nctx7 docs react-router","handlingStrategy":"validation","validationCode":"if (!library || library.trim().length === 0) { console.error('Library name required'); process.exit(1); }","typeGuard":"const hasResults = (d: { results?: unknown[] }): d is { results: unknown[] } => Array.isArray(d.results) && d.results.length > 0;","tryCatchPattern":"if (!hasResults(data)) { spinner?.warn(`No libraries found matching \"${library}\"`); return; }","preventionTips":["Verify library names against context7.com before scripting","Prefer simple, canonical package names in queries","Handle empty results explicitly instead of assuming a match"],"tags":["cli","docs","search"],"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"}