upstash/context7 · error

Please try again

Error message

Please try again

What it means

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.

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 5284672feb)

Solutions

  1. Re-run `context7 generate` — transient API failures usually clear on a second attempt.
  2. Re-authenticate with `context7 login` (or equivalent) so a fresh access token is sent, then retry.
  3. Check connectivity/proxy settings to the Context7 API host (curl the endpoint from the same shell).
  4. If it persists with a specific library set, report the repository names + motivation to the Context7 issue tracker.

Example fix

// before
log.warn(questionsResult.message || "Please try again");
// after - surface the machine-readable failure so users can diagnose it
log.warn(
  questionsResult.message ||
    `Question generation failed (${questionsResult.error ?? "no questions returned"}) - please try again`
);
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight: fail fast with a clear message instead of a generic retry hint
import { getValidAccessToken } from "../utils/auth.js";

const token = await getValidAccessToken();
if (!token) {
  console.error("Not authenticated - run `context7 login` before generating.");
  process.exit(1);
}

Type guard

type QuestionSuccess = { questions: NonEmptyArray<SkillQuestion> };
type QuestionFailure = { error: string; message?: string };

function isQuestionSuccess(
  r: QuestionSuccess | QuestionFailure
): r is QuestionSuccess {
  return !("error" in r) && Array.isArray(r.questions) && r.questions.length > 0;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of upstash/context7@5284672feb (2026-08-18). Data as JSON: /api/errors/e59b6fa71b4e5626. Report an issue: GitHub.