upstash/context7 · info

Remove cancelled

Error message

Remove cancelled

What it means

In `context7 remove`, after detection finds configured agents and no --yes flag is set, promptAgents() shows a multi-select of detected agents. It returns null when the user cancels (Ctrl+C/Esc via @inquirer, or an empty selection), so resolveAgents() warns 'Remove cancelled' and returns an empty list — nothing is uninstalled.

Source

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

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 --claude, --cursor, --opencode, --codex, --antigravity, or --gemini."
    );
    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 5284672feb)

Solutions

  1. Re-run `context7 remove` and select at least one agent, or pass agent flags (--claude, --cursor, ...) to skip the prompt.
  2. Use `context7 remove --yes` to accept all detected agents without an interactive prompt (useful in scripts).
Defensive patterns

Strategy: validation

Validate before calling

// For scripted removals, skip the prompt entirely
// context7 remove --claude --yes   (flags + --yes never show promptAgents)

Type guard

function selectedAgents(selected: SetupAgent[] | null): selected is SetupAgent[] {
  return selected !== null && selected.length > 0;
}

Prevention

When it happens

Trigger: Cancelling or submitting an empty selection at the 'which agents to remove?' prompt when multiple Context7 setups are detected and --yes was not passed.

Common situations: User runs remove to 'see what would be removed' then bails at the selection; accidental Esc at the multi-select; user meant to run setup instead of remove.

Related errors


AI-assisted analysis of upstash/context7@5284672feb (2026-08-18). Data as JSON: /api/errors/2eb4a5114e8aa445. Report an issue: GitHub.