upstash/context7 · info

Generation cancelled

Error message

Generation cancelled

What it means

The 'Describe the expertise:' input prompt threw, which in practice means the user cancelled it (Ctrl+C or Escape in the @clack-style prompt) or stdin hit EOF in a non-TTY environment. The catch block treats any prompt rejection as cancellation, warns, and returns cleanly — no API calls or files happen.

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

Solutions

  1. Nothing to repair — simply re-run `context7 skill generate` and answer the prompt
  2. Run the command in a real interactive terminal (TTY), since it is a guided wizard
  3. Do not pipe or redirect stdin when invoking it
Defensive patterns

Strategy: try-catch

Type guard

function isCancelSignal(e: unknown): boolean {
  // @clack prompts expose isCancel(); raw Ctrl+C surfaces as a cancel/abort rejection
  return typeof e === "object" && e !== null && "name" in e && (e as { name?: string }).name === "Cancel";
}

Try / catch

try {
  motivation = await input({ message: "Describe the expertise:" });
} catch (err) {
  if (isCancelSignal(err)) { console.info("Generation cancelled"); return; } // graceful exit
  throw err; // real errors should not be silenced
}

Prevention

When it happens

Trigger: Pressing Ctrl+C or Esc at the expertise prompt; running the interactive command in a pipeline/CI job where stdin closes and the prompt aborts.

Common situations: Users backing out of the wizard after seeing the prompt; running `context7 skill generate` from scripts where no interactive terminal is attached.

Related errors


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