{"record":{"id":"5f81c2fbe430b465","repo":"dubinc/dub","slug":"you-canceled-the-prompt-5f81c2","errorCode":null,"errorMessage":"You canceled the prompt.","messagePattern":"You canceled the prompt\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"packages/cli/src/commands/shorten.ts","lineNumber":40,"sourceCode":"      if (!url) {\n        linkData = await prompts(\n          [\n            {\n              type: \"text\",\n              name: \"url\",\n              message: \"Enter your Destination URL:\",\n            },\n            {\n              type: \"text\",\n              name: \"key\",\n              message: \"Enter your Short link:\",\n              initial: getNanoid(),\n            },\n          ],\n          {\n            onCancel: () => {\n              logger.info(\"\");\n              logger.warn(\"You canceled the prompt.\");\n              logger.info(\"\");\n              process.exit(0);\n            },\n          },\n        );\n      }\n\n      const spinner = ora(\"Creating new short link\").start();\n\n      try {\n        const generatedShortLink = await createLink(linkData);\n\n        spinner.succeed(\"New short link created!\");\n\n        logger.info(\"\");\n        logger.info(chalk.green(generatedShortLink.shortLink));\n        logger.info(\"\");\n      } catch (error) {","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/dubinc/dub/blob/f216b94a24ca5a0a48c6543ee10392c9006c8b75/packages/cli/src/commands/shorten.ts#L22-L58","documentation":"In the `shorten` command, the interactive prompt's onCancel handler prints this warning and exits with code 0 when the user aborts while being asked for link details (e.g. the destination URL with a generated nanoid initial value). It is the intended, graceful path for aborting the prompt, not a thrown error.","triggerScenarios":"Pressing Ctrl+C or Esc while the shorten-link prompt (destination URL / slug with `initial: getNanoid()`) is active.","commonSituations":"User decides not to shorten a link, aborts to copy the URL elsewhere first, or accidental Esc/Ctrl+C due to terminal keybinding quirks.","solutions":["No fix needed — re-run the `shorten` command and complete the prompt.","If escapes are accidental, review terminal multiplexer/IDE key mappings for Esc and Ctrl+C.","Note the random nanoid slug is regenerated on each run; canceling and restarting produces a new one — pass a custom slug in the prompt if determinism matters."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Detect non-interactive terminals before prompting\nif (!process.stdin.isTTY) {\n  console.warn('No interactive terminal; pass the URL as an argument instead');\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":"// clack prompts return/throw a cancel symbol — check with isCancel\nconst url = await text({ message: 'Destination URL', initialValue: getNanoid() });\nif (clack.isCancel(url)) {\n  console.warn('You canceled the prompt.');\n  process.exit(0);\n}","preventionTips":["Complete the prompt or cancel deliberately; either way is a clean exit (code 0).","Provide CLI flags as an alternative to prompts for automation.","Remember the nanoid slug regenerates on each run — canceling and restarting yields a new slug.","Review keybindings if Esc/Ctrl+C cancellations happen accidentally."],"tags":["cli","user-canceled","prompt"],"backgroundTag":"prompt-cancelled","analyzedSha":"f216b94a24ca5a0a48c6543ee10392c9006c8b75","analyzedAt":"2026-08-31T18:35:50.395Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}