upstash/context7 · info

Setup cancelled

Error message

Setup cancelled

What it means

In `context7 setup`, when no agent flags are given and detection/auto-accept (--yes with detected agents) does not apply, promptAgents() shows the agent chooser. A null result — Ctrl+C/Esc or empty selection — makes resolveAgents() warn 'Setup cancelled' and return [], ending the command before anything is installed.

Source

Thrown at packages/cli/src/commands/setup.ts:222

      { getName: (a: SetupAgent) => SETUP_AGENT_NAMES[a] }
    );
  } catch {
    return null;
  }
}

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

  const detected = await detectAgents(scope);

  if (detected.length > 0 && options.yes) return detected;

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

/** Install a rule for an agent, handling both "file" (standalone) and "append" (AGENTS.md) types. */
async function installRule(
  agentName: SetupAgent,
  mode: SetupMode,
  scope: Scope
): Promise<{ status: string; path: string }> {
  const agent = getAgent(agentName);
  const rule = agent.rule;
  const content = await getRuleContent(mode, agentName);

  if (rule.kind === "file") {
    const ruleDir =
      scope === "global" ? rule.dir("global") : join(process.cwd(), rule.dir("project"));

View on GitHub (pinned to 5284672feb)

Solutions

  1. Re-run `context7 setup` and pick at least one agent, or pass explicit flags (e.g. `context7 setup --claude`) to skip the prompt.
  2. Run setup in a real terminal (TTY); for scripts combine flags with --yes.
Defensive patterns

Strategy: validation

Validate before calling

// Skip the agent prompt with explicit flags
// context7 setup --claude        (promptAgents is never reached)

Type guard

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

Prevention

When it happens

Trigger: Cancelling the interactive 'which agents to configure?' prompt at the start of `context7 setup` when no --claude/--cursor/... flags were supplied.

Common situations: First-time user launches setup to look around and aborts; accidental Esc; running setup in a non-interactive shell where the inquirer prompt throws immediately.

Related errors


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