upstash/context7 · info

Generation cancelled

Error message

Generation cancelled

What it means

generateCommand wraps the expertise-description prompt in try/catch; if the prompt throws (typically user abort via Ctrl+C or prompt cancellation), it logs 'Generation cancelled' and returns. This is the CLI's graceful-cancellation path, not a failure of generation logic.

Solutions

  1. Re-run `ctx7 generate` and complete the prompt to proceed
  2. Run in an interactive TTY so prompts can receive input
  3. Nothing is broken — cancellation is an intentional early return
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const motivation = await input({ message: 'Describe the expertise:' });
} catch {
  log.warn('Generation cancelled');
  return; // treat as intentional abort, not failure
}

Prevention

When it happens

Trigger: The `input({ message: 'Describe the expertise:' })` prompt rejects — user presses Ctrl+C/Ctrl+D or the prompt is cancelled — throwing before motivation is captured.

Common situations: User changes their mind mid-wizard; non-interactive terminal where prompts cannot read stdin; SIGINT during the prompt.

Related errors


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

Appendix: source

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

    log.blank();
    console.log(pc.red('  ✕ "Build OAuth with NextAuth"'));
    console.log(pc.green('  ✓ "OAuth authentication patterns and pitfalls with NextAuth.js"'));
  }
  log.blank();

  let motivation: string;
  try {
    motivation = await input({
      message: "Describe the expertise:",
    });

    if (!motivation.trim()) {
      log.warn("Expertise description is required");
      return;
    }
    motivation = motivation.trim();
  } catch {
    log.warn("Generation cancelled");
    return;
  }

  log.blank();
  console.log(
    pc.dim(
      "To generate this skill, we will read relevant documentation and examples\nfrom Context7.\n"
    )
  );
  console.log(
    pc.dim(
      "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"
    )
  );
  console.log(pc.dim("You can adjust which sources the skill is based on.\n"));

  const searchSpinner = ora("Finding relevant sources...").start();
  const searchResult = await searchLibraries(motivation, accessToken);

View on GitHub (pinned to 4416fb855b)