{"record":{"id":"cb899bdf0d44342d","repo":"upstash/context7","slug":"questionsresult-message-please-try-again","errorCode":null,"errorMessage":"questionsResult.message || \"Please try again\"","messagePattern":"questionsResult\\.message \\|\\| \"Please try again\"","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/generate.ts","lineNumber":255,"sourceCode":"      log.info(\"No sources selected. Try running the command again.\");\n      return;\n    }\n  } catch {\n    log.warn(\"Generation cancelled\");\n    return;\n  }\n\n  log.blank();\n\n  const questionsSpinner = ora(\n    \"Preparing follow-up questions to clarify scope and constraints...\"\n  ).start();\n  const librariesInput = selectedLibraries.map((lib) => ({ id: lib.id, name: lib.title }));\n  const questionsResult = await getSkillQuestions(librariesInput, motivation, accessToken);\n\n  if (questionsResult.error || !questionsResult.questions?.length) {\n    questionsSpinner.fail(pc.red(\"Failed to generate questions\"));\n    log.warn(questionsResult.message || \"Please try again\");\n    return;\n  }\n\n  questionsSpinner.succeed(pc.green(\"Questions prepared\"));\n  log.blank();\n\n  const answers: SkillAnswer[] = [];\n  try {\n    for (let i = 0; i < questionsResult.questions.length; i++) {\n      const q = questionsResult.questions[i];\n      const questionNum = i + 1;\n      const totalQuestions = questionsResult.questions.length;\n\n      const answer = await selectOrInput({\n        message: `${pc.dim(`[${questionNum}/${totalQuestions}]`)} ${q.question}`,\n        options: q.options,\n        recommendedIndex: q.recommendedIndex,\n      });","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/upstash/context7/blob/4416fb855b8f752be735e34f943b5d0762701aad/packages/cli/src/commands/generate.ts#L237-L273","documentation":"After sources are selected, generateCommand calls getSkillQuestions with the chosen libraries and motivation; if it returns an error or no questions, the spinner fails with 'Failed to generate questions' and the CLI logs questionsResult.message (fallback 'Please try again'). This indicates the upstream question-generation API failed or produced an empty question set.","triggerScenarios":"`getSkillQuestions(librariesInput, motivation, accessToken)` resolves with { error: true } or questions undefined/empty.","commonSituations":"Transient upstream API failure; invalid/expired access token; selected library IDs no longer valid server-side; rate limiting on the generation endpoint.","solutions":["Re-run `ctx7 generate` and retry — the fallback message suggests a transient failure","Check questionsResult.message (logged) for the specific upstream error and address it","Verify your access token is valid and you are not rate-limited","Try selecting different/fewer sources in the selection step"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if (!accessToken) { throw new Error('Valid access token required before generating questions'); }","typeGuard":"function hasQuestions(r: QuestionsResult): r is QuestionsResult & { questions: Question[] } { return !r.error && Array.isArray(r.questions) && r.questions.length > 0; }","tryCatchPattern":"const res = await getSkillQuestions(librariesInput, motivation, accessToken);\nif (res.error || !res.questions?.length) {\n  log.warn(res.message ?? 'Please try again');\n  return;\n}","preventionTips":["Retry transient failures — the endpoint is occasionally flaky","Validate the access token before starting generation","Select well-known, currently valid libraries as sources","Watch for rate limits when running generation repeatedly"],"tags":["cli","api","skill-generation","retry"],"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"}