{"record":{"id":"f20439269fa67274","repo":"upstash/context7","slug":"searchresult-message-try-a-different-descripti","errorCode":null,"errorMessage":"searchResult.message || \"Try a different description\"","messagePattern":"searchResult\\.message \\|\\| \"Try a different description\"","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/generate.ts","lineNumber":160,"sourceCode":"  log.blank();\n  console.log(\n    pc.dim(\n      \"To generate this skill, we will read relevant documentation and examples\\nfrom Context7.\\n\"\n    )\n  );\n  console.log(\n    pc.dim(\n      \"These sources are used to:\\n• extract best practices and constraints\\n• compare patterns across official docs and examples\\n• avoid outdated or incorrect guidance\\n\"\n    )\n  );\n  console.log(pc.dim(\"You can adjust which sources the skill is based on.\\n\"));\n\n  const searchSpinner = ora(\"Finding relevant sources...\").start();\n  const searchResult = await searchLibraries(motivation, accessToken);\n\n  if (searchResult.error || !searchResult.results?.length) {\n    searchSpinner.fail(pc.red(\"No sources found\"));\n    log.warn(searchResult.message || \"Try a different description\");\n    return;\n  }\n\n  searchSpinner.succeed(pc.green(`Found ${searchResult.results.length} relevant sources`));\n  log.blank();\n\n  if (searchResult.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\"\n    );\n    log.blank();\n  }\n\n  let selectedLibraries: LibrarySearchResult[];\n  try {\n    const formatProjectId = (id: string) => {\n      return id.startsWith(\"/\") ? id.slice(1) : id;\n    };","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/upstash/context7/blob/4416fb855b8f752be735e34f943b5d0762701aad/packages/cli/src/commands/generate.ts#L142-L178","documentation":"After the 'Finding relevant sources...' search, if searchLibraries returns an error or an empty results array, generateCommand fails the spinner with 'No sources found' and logs searchResult.message (or the fallback 'Try a different description'). This surfaces upstream search API failures or no-match outcomes during expertise generation.","triggerScenarios":"`searchLibraries(motivation, accessToken)` resolves with { error: true } (API/network/auth failure) or results undefined/empty — the motivation matched no libraries.","commonSituations":"Vague or overly narrow expertise description; expired/invalid access token causing API error; network outage; no indexed library matches the domain described.","solutions":["Rewrite the expertise description with clearer, more common technology terms and retry","Check the logged searchResult.message for the upstream API error detail and fix accordingly","Verify network connectivity and that your access token is valid/not expired","Re-run `ctx7 generate` after addressing the cause"],"exampleFix":"// before\nmotivation = \"stuff with databases\"\n// after\nmotivation = \"Querying PostgreSQL with connection pooling in Node.js\"","handlingStrategy":"retry","validationCode":"if (!motivation || motivation.trim().length < 10) { console.warn('Describe the expertise with concrete technologies'); return; }","typeGuard":null,"tryCatchPattern":"const res = await searchLibraries(motivation, accessToken);\nif (res.error || !res.results?.length) {\n  log.warn(res.message ?? 'Try a different description');\n  return;\n}","preventionTips":["Write expertise descriptions naming concrete technologies (e.g. 'PostgreSQL pooling in Node.js')","Keep your access token fresh and valid","Check network/API status before long generation sessions","Retry once on transient failures before changing the description"],"tags":["cli","search","api","empty-result"],"backgroundTag":"api-error-response","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"}