{"record":{"id":"b21709dd3c3dedcd","repo":"upstash/context7","slug":"generation-cancelled","errorCode":null,"errorMessage":"Generation cancelled","messagePattern":"Generation cancelled","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"packages/cli/src/commands/generate.ts","lineNumber":138,"sourceCode":"    log.blank();\n    console.log(pc.red('  ✕ \"Build OAuth with NextAuth\"'));\n    console.log(pc.green('  ✓ \"OAuth authentication patterns and pitfalls with NextAuth.js\"'));\n  }\n  log.blank();\n\n  let motivation: string;\n  try {\n    motivation = await input({\n      message: \"Describe the expertise:\",\n    });\n\n    if (!motivation.trim()) {\n      log.warn(\"Expertise description is required\");\n      return;\n    }\n    motivation = motivation.trim();\n  } catch {\n    log.warn(\"Generation cancelled\");\n    return;\n  }\n\n  log.blank();\n  console.log(\n    pc.dim(\n      \"To generate this skill, we will read relevant documentation and examples\\nfrom Context7.\\n\"\n    )\n  );\n  console.log(\n    pc.dim(\n      \"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\"\n    )\n  );\n  console.log(pc.dim(\"You can adjust which sources the skill is based on.\\n\"));\n\n  const searchSpinner = ora(\"Finding relevant sources...\").start();\n  const searchResult = await searchLibraries(motivation, accessToken);","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/upstash/context7/blob/5284672feb575908efead6fcf1b5e542f8d607bb/packages/cli/src/commands/generate.ts#L120-L156","documentation":"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.","triggerScenarios":"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.","commonSituations":"Users backing out of the wizard after seeing the prompt; running `context7 skill generate` from scripts where no interactive terminal is attached.","solutions":["Nothing to repair — simply re-run `context7 skill generate` and answer the prompt","Run the command in a real interactive terminal (TTY), since it is a guided wizard","Do not pipe or redirect stdin when invoking it"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isCancelSignal(e: unknown): boolean {\n  // @clack prompts expose isCancel(); raw Ctrl+C surfaces as a cancel/abort rejection\n  return typeof e === \"object\" && e !== null && \"name\" in e && (e as { name?: string }).name === \"Cancel\";\n}","tryCatchPattern":"try {\n  motivation = await input({ message: \"Describe the expertise:\" });\n} catch (err) {\n  if (isCancelSignal(err)) { console.info(\"Generation cancelled\"); return; } // graceful exit\n  throw err; // real errors should not be silenced\n}","preventionTips":["Run `context7 skill generate` in an interactive terminal","Do not pipe or redirect stdin into the wizard","Treat cancellation as expected control flow, not an error"],"tags":["cli","interactive","cancel","sigint","generate"],"backgroundTag":"user-cancelled-prompt","analyzedSha":"5284672feb575908efead6fcf1b5e542f8d607bb","analyzedAt":"2026-08-18T18:00:18.510Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}