{"record":{"id":"e59b6fa71b4e5626","repo":"upstash/context7","slug":"please-try-again","errorCode":null,"errorMessage":"Please try again","messagePattern":"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/5284672feb575908efead6fcf1b5e542f8d607bb/packages/cli/src/commands/generate.ts#L237-L273","documentation":"Emitted by the `context7 generate` wizard when getSkillQuestions() (utils/api.ts) resolves with an error payload or an empty/missing questions array after the user picked libraries and typed a motivation. The generic 'Please try again' text only appears when the API response carries no `message` field, so it masks the real failure: a network error, auth failure, rate limit, or a backend that simply produced no clarifying questions. The spinner is failed as 'Failed to generate questions' and the command exits without generating a skill.","triggerScenarios":"Running `context7 generate`, selecting libraries, entering a motivation, and then having `getSkillQuestions(librariesInput, motivation, accessToken)` return `{ error: ... }` or `questions: []`/undefined — e.g. HTTP 5xx from the skills API, an expired/invalid access token, a rate-limited hosted endpoint, or a proxy blocking the API host.","commonSituations":"Stale auth token from a previous login; corporate proxy/firewall blocking the Context7 API; rate limiting after repeated generate runs; backend regression that returns zero questions for rarely-used library combinations.","solutions":["Re-run `context7 generate` — transient API failures usually clear on a second attempt.","Re-authenticate with `context7 login` (or equivalent) so a fresh access token is sent, then retry.","Check connectivity/proxy settings to the Context7 API host (curl the endpoint from the same shell).","If it persists with a specific library set, report the repository names + motivation to the Context7 issue tracker."],"exampleFix":"// before\nlog.warn(questionsResult.message || \"Please try again\");\n// after - surface the machine-readable failure so users can diagnose it\nlog.warn(\n  questionsResult.message ||\n    `Question generation failed (${questionsResult.error ?? \"no questions returned\"}) - please try again`\n);","handlingStrategy":"retry","validationCode":"// Pre-flight: fail fast with a clear message instead of a generic retry hint\nimport { getValidAccessToken } from \"../utils/auth.js\";\n\nconst token = await getValidAccessToken();\nif (!token) {\n  console.error(\"Not authenticated - run `context7 login` before generating.\");\n  process.exit(1);\n}","typeGuard":"type QuestionSuccess = { questions: NonEmptyArray<SkillQuestion> };\ntype QuestionFailure = { error: string; message?: string };\n\nfunction isQuestionSuccess(\n  r: QuestionSuccess | QuestionFailure\n): r is QuestionSuccess {\n  return !(\"error\" in r) && Array.isArray(r.questions) && r.questions.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Keep the access token fresh - call getValidAccessToken() before starting the wizard, not only when the request fires.","Wrap getSkillQuestions in a bounded retry (1-2 attempts with backoff) for transient 5xx/network responses.","Log questionsResult.error alongside the fallback message so failures are diagnosable.","Run the CLI on a network where the Context7 API host is reachable (check proxies)."],"tags":["cli","generate","api","network","auth"],"backgroundTag":"api-request-failed","analyzedSha":"5284672feb575908efead6fcf1b5e542f8d607bb","analyzedAt":"2026-08-18T18:00:18.510Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}