{"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/4416fb855b8f752be735e34f943b5d0762701aad/packages/cli/src/commands/generate.ts#L120-L156","documentation":"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.","triggerScenarios":"The `input({ message: 'Describe the expertise:' })` prompt rejects — user presses Ctrl+C/Ctrl+D or the prompt is cancelled — throwing before motivation is captured.","commonSituations":"User changes their mind mid-wizard; non-interactive terminal where prompts cannot read stdin; SIGINT during the prompt.","solutions":["Re-run `ctx7 generate` and complete the prompt to proceed","Run in an interactive TTY so prompts can receive input","Nothing is broken — cancellation is an intentional early return"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const motivation = await input({ message: 'Describe the expertise:' });\n} catch {\n  log.warn('Generation cancelled');\n  return; // treat as intentional abort, not failure\n}","preventionTips":["Run the command in an interactive TTY","Do not send SIGINT/Ctrl+C unless you intend to cancel","Complete or explicitly cancel prompts rather than closing the terminal"],"tags":["cli","prompt","user-cancelled"],"backgroundTag":"operation-not-supported","analyzedSha":"4416fb855b8f752be735e34f943b5d0762701aad","analyzedAt":"2026-09-16T20:28:07.148Z","contentChangedAt":"2026-09-16T20:28:07.148Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}