upstash/context7 · warning
No Context7 setup detected. Pass --claude, --cursor, --openc
Error message
No Context7 setup detected. Pass --claude, --cursor, --opencode, --codex, --antigravity, or --gemini.
What it means
`context7 remove` first resolves what to uninstall: explicit agent flags, then detectConfiguredAgents(scope) which scans config files (e.g. .mcp.json, agent rules) for Context7 setup. When nothing is found and no agent flags were passed, there is nothing to remove, so the CLI warns 'No Context7 setup detected' and lists the accepted flags instead of prompting.
Source
Thrown at packages/cli/src/commands/remove.ts:156
loop: false,
theme: CHECKBOX_THEME,
},
{ getName: (mode: UninstallMode) => MODE_LABELS[mode] }
);
} catch {
return null;
}
}
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"];
View on GitHub (pinned to 5284672feb)
Solutions
- Check which scope holds the config: re-run with the other scope flag (e.g. `--scope user`/`--global` vs default project).
- Run `context7 remove` from the project root where setup originally ran (the one containing .mcp.json or agent rule files).
- If you know the agent, pass its flag directly — `context7 remove --claude` skips detection entirely.
- Verify a Context7 config actually exists (look for .mcp.json / agent config dirs) before invoking remove.
Defensive patterns
Strategy: validation
Validate before calling
import { access } from "node:fs/promises";
// Pre-check the scopes a Context7 setup would live in before running remove
async function hasAnySetup(candidates: string[]): Promise<boolean> {
const results = await Promise.allSettled(candidates.map((p) => access(p)));
return results.some((r) => r.status === "fulfilled");
}
// e.g. candidates = [join(homedir(), ".claude"), join(process.cwd(), ".mcp.json")] Type guard
import type { SetupAgent } from "../agents.js";
function hasDetectedAgents(agents: SetupAgent[]): boolean {
return Array.isArray(agents) && agents.length > 0;
} Prevention
- Run remove from the same directory (and scope) where setup was originally executed.
- Remember which scope you installed to (project vs user/global) and pass the matching scope flag.
- When in doubt, pass explicit agent flags (--claude, ...) — they bypass detection.
- Keep a note of which Context7 config files setup created so removal is deterministic.
When it happens
Trigger: Running `context7 remove` on a machine/directory with no Context7 MCP or rule configuration for the selected scope; running with `--scope project` in a repo whose Context7 config lives in the user (global) scope, or vice versa; configs were already removed by a previous run.
Common situations: Wrong directory: the setup was done in another project so project-scope detection finds nothing; setup was installed under a different user account (homedir); the user manually deleted .mcp.json earlier; mixing up remove scope flags.
Related errors
- downloadData.error || "no files"
- Remove cancelled
- Setup cancelled
- Cancelled
- await describeErrorResponse(response, fallback)
AI-assisted analysis of upstash/context7@5284672feb (2026-08-18).
Data as JSON: /api/errors/008c91012f47fc60.
Report an issue: GitHub.