dubinc/dub · info
You canceled the prompt.
Error message
You canceled the prompt.
What it means
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.
Source
Thrown at packages/cli/src/commands/shorten.ts:40
if (!url) {
linkData = await prompts(
[
{
type: "text",
name: "url",
message: "Enter your Destination URL:",
},
{
type: "text",
name: "key",
message: "Enter your Short link:",
initial: getNanoid(),
},
],
{
onCancel: () => {
logger.info("");
logger.warn("You canceled the prompt.");
logger.info("");
process.exit(0);
},
},
);
}
const spinner = ora("Creating new short link").start();
try {
const generatedShortLink = await createLink(linkData);
spinner.succeed("New short link created!");
logger.info("");
logger.info(chalk.green(generatedShortLink.shortLink));
logger.info("");
} catch (error) {View on GitHub (pinned to f216b94a24)
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.
Defensive patterns
Strategy: try-catch
Validate before calling
// Detect non-interactive terminals before prompting
if (!process.stdin.isTTY) {
console.warn('No interactive terminal; pass the URL as an argument instead');
process.exit(1);
} Try / catch
// clack prompts return/throw a cancel symbol — check with isCancel
const url = await text({ message: 'Destination URL', initialValue: getNanoid() });
if (clack.isCancel(url)) {
console.warn('You canceled the prompt.');
process.exit(0);
} Prevention
- 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.
When it happens
Trigger: Pressing Ctrl+C or Esc while the shorten-link prompt (destination URL / slug with `initial: getNanoid()`) is active.
Common situations: User decides not to shorten a link, aborts to copy the URL elsewhere first, or accidental Esc/Ctrl+C due to terminal keybinding quirks.
Related errors
- You canceled the prompt.
- Access token not found. Please run `dub login` to authentica
- Failed to create or update config file
- Not found
- Authorization code not found. Please start the login process
AI-assisted analysis of dubinc/dub@f216b94a24 (2026-08-31).
Data as JSON: /api/errors/5f81c2fbe430b465.
Report an issue: GitHub.