upstash/context7 · info

Remove cancelled

Error message

Remove cancelled

What it means

In remove.ts resolveAgents(), after detecting configured agents, the CLI prompts the user to select which ones to remove via promptAgents(detected). If the user aborts the prompt (Esc/Ctrl+C or explicit cancel), it logs 'Remove cancelled' and returns an empty array so nothing is uninstalled.

Solutions

  1. Rerun `context7 remove` and select the agents to remove
  2. Use --yes to skip the prompt and remove all detected integrations
  3. Pass explicit agent flags (e.g. --cursor) to bypass the picker entirely

Example fix

// before: cancels at picker
// $ context7 remove
// after
// $ context7 remove --yes      # or: context7 remove --cursor
Defensive patterns

Strategy: validation

Validate before calling

if (!process.stdout.isTTY) {
  args.push("--yes"); // avoid the agent picker aborting in scripts
}

Prevention

When it happens

Trigger: promptAgents(detected) resolves falsy — the user cancels the multi-select of agents during a `context7 remove` run that had detected integrations but no explicit flags and no --yes.

Common situations: User changes their mind mid-uninstall; pressing Esc/Ctrl+C at the agent picker; running remove in a weak TTY where the prompt aborts immediately.

Related errors


AI-assisted analysis of upstash/context7@4416fb855b (2026-09-16). Data as JSON: /api/errors/2eb4a5114e8aa445. Report an issue: GitHub.

Appendix: source

Thrown at packages/cli/src/commands/remove.ts:153

async function resolveAgents(options: UninstallOptions, scope: Scope): Promise<SetupAgent[]> {
  const explicit = getSelectedAgents(options);
  if (explicit.length > 0) return explicit;

  const detected = await detectConfiguredAgents(scope);
  if (detected.length > 0 && options.yes) return detected;

  if (detected.length === 0) {
    log.warn(
      `No Context7 setup detected. Pass one of: ${ALL_AGENT_NAMES.map((name) => `--${name}`).join(", ")}.`
    );
    return [];
  }

  log.blank();
  const selected = await promptAgents(detected);
  if (!selected) {
    log.warn("Remove cancelled");
    return [];
  }

  return selected;
}

function resolveFlagModes(options: UninstallOptions): UninstallMode[] {
  if (options.all) return ["mcp", "cli"];

  const selected: UninstallMode[] = [];

  if (options.mcp) selected.push("mcp");
  if (options.cli) selected.push("cli");

  return selected.length > 0 ? selected : ["mcp", "cli"];
}

async function pathExists(path: string): Promise<boolean> {

View on GitHub (pinned to 4416fb855b)