upstash/context7 · error

questionsResult.message || "Please try again"

Error message

questionsResult.message || "Please try again"

What it means

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.

Solutions

  1. Re-run `ctx7 generate` and retry — the fallback message suggests a transient failure
  2. Check questionsResult.message (logged) for the specific upstream error and address it
  3. Verify your access token is valid and you are not rate-limited
  4. Try selecting different/fewer sources in the selection step
Defensive patterns

Strategy: retry

Validate before calling

if (!accessToken) { throw new Error('Valid access token required before generating questions'); }

Type guard

function hasQuestions(r: QuestionsResult): r is QuestionsResult & { questions: Question[] } { return !r.error && Array.isArray(r.questions) && r.questions.length > 0; }

Try / catch

const res = await getSkillQuestions(librariesInput, motivation, accessToken);
if (res.error || !res.questions?.length) {
  log.warn(res.message ?? 'Please try again');
  return;
}

Prevention

When it happens

Trigger: `getSkillQuestions(librariesInput, motivation, accessToken)` resolves with { error: true } or questions undefined/empty.

Common situations: Transient upstream API failure; invalid/expired access token; selected library IDs no longer valid server-side; rate limiting on the generation endpoint.

Related errors


AI-assisted analysis of upstash/context7@4416fb855b (2026-09-16). Data as JSON: /api/errors/cb899bdf0d44342d. Report an issue: GitHub.

Appendix: source

Thrown at packages/cli/src/commands/generate.ts:255

      log.info("No sources selected. Try running the command again.");
      return;
    }
  } catch {
    log.warn("Generation cancelled");
    return;
  }

  log.blank();

  const questionsSpinner = ora(
    "Preparing follow-up questions to clarify scope and constraints..."
  ).start();
  const librariesInput = selectedLibraries.map((lib) => ({ id: lib.id, name: lib.title }));
  const questionsResult = await getSkillQuestions(librariesInput, motivation, accessToken);

  if (questionsResult.error || !questionsResult.questions?.length) {
    questionsSpinner.fail(pc.red("Failed to generate questions"));
    log.warn(questionsResult.message || "Please try again");
    return;
  }

  questionsSpinner.succeed(pc.green("Questions prepared"));
  log.blank();

  const answers: SkillAnswer[] = [];
  try {
    for (let i = 0; i < questionsResult.questions.length; i++) {
      const q = questionsResult.questions[i];
      const questionNum = i + 1;
      const totalQuestions = questionsResult.questions.length;

      const answer = await selectOrInput({
        message: `${pc.dim(`[${questionNum}/${totalQuestions}]`)} ${q.question}`,
        options: q.options,
        recommendedIndex: q.recommendedIndex,
      });

View on GitHub (pinned to 4416fb855b)