upstash/context7 · info
Setup cancelled
Error message
Setup cancelled
What it means
In setup.ts resolveAgents(), when no agent is given via flags and --yes is not set, the CLI prompts the user to pick which agent(s) to configure with promptAgents(). Cancelling that prompt logs 'Setup cancelled' and returns an empty array, aborting setup before any files are written.
Solutions
- Rerun `context7 setup` and select an agent in the prompt
- Use `context7 setup --yes` to accept all detected agents without prompting
- Pass an explicit agent flag (e.g. --cursor) to skip the picker
Example fix
// before // $ context7 setup # cancel at agent picker // after // $ context7 setup --cursor
Defensive patterns
Strategy: validation
Validate before calling
if (!process.stdout.isTTY) {
args.push("--yes"); // or pass an explicit agent flag
} Prevention
- Run setup interactively, or pass --yes / --<agent> flags in scripts
- Keep an agent selection in mind before starting setup
- Abort deliberately only if you intend to stop setup
When it happens
Trigger: promptAgents() resolves falsy during `context7 setup` — user pressed Esc/Ctrl+C or chose cancel in the agent-selection prompt; detected agents existed but --yes was not passed so prompting still occurred, or nothing was detected and a prompt was shown.
Common situations: Abandoning a Context7 setup midway; running setup in a non-interactive shell where the picker aborts; pressing the wrong key in the agent multi-select.
Related errors
AI-assisted analysis of upstash/context7@4416fb855b (2026-09-16).
Data as JSON: /api/errors/de57920a7e0955f8.
Report an issue: GitHub.
Appendix: source
Thrown at packages/cli/src/commands/setup.ts:261
{ getName: (a: SetupAgent) => getAgent(a).displayName }
);
} 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,
scope: Scope,
content: string
): Promise<{ status: string; path: string }> {
const agent = getAgent(agentName);
const rule = agent.rule;
if (rule.kind === "file") {
const ruleContent = `${rule.contentPrefix ?? ""}${content}`;
const ruleDir =
scope === "global" ? rule.dir("global") : join(process.cwd(), rule.dir("project"));View on GitHub (pinned to 4416fb855b)