upstash/context7 · warning

No Context7 setup detected. Pass one of: ${ALL_AGENT_NAMES.m

Error message

No Context7 setup detected. Pass one of: ${ALL_AGENT_NAMES.map((name) => `--${name}`).join(", ")}.

What it means

Warning log (not a thrown exception) emitted by the CLI remove command's resolveAgents when no Context7-configured agents are detected for the given scope and no --<agent> flags were passed. It returns an empty agent list, so nothing is removed.

Source

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

        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 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"];

View on GitHub (pinned to 80e681a507)

Solutions

  1. Pass an explicit agent flag matching your setup, e.g. context7 remove --cursor or --claude (see the listed ALL_AGENT_NAMES options).
  2. Run in the project directory that actually contains the Context7 agent config files.
  3. Check the correct scope: retry with global vs project scope depending on where setup ran.
  4. List available agent flags via context7 remove --help and pick the one you configured.

Example fix

// before
$ context7 remove
// warn: No Context7 setup detected...
// after
$ context7 remove --cursor --yes
Defensive patterns

Strategy: validation

Validate before calling

// Check for setup before running remove
import { existsSync } from 'fs';
const hasSetup = ['.context7', '.cursor/mcp.json', '.claude/settings.json'].some(existsSync);
if (!hasSetup) console.warn('No Context7 setup found in this directory; run context7 init first or pass an explicit --agent flag.');

Try / catch

// CLI-level: check the warn output / empty agent list
const agents = await resolveAgents(options);
if (agents.length === 0) {
  console.error('Nothing removed: pass --cursor / --claude etc. explicitly.');
  process.exitCode = 1;
}

Prevention

When it happens

Trigger: Running `context7 remove` (or similar) with no --cursor/--claude/etc. flag, no --yes, and detectConfiguredAgents(scope) finds zero agent config files in the project/global scope.

Common situations: Running remove in a directory where Context7 was never initialized, config files were already deleted manually, or the scope (project vs global) differs from where setup was done.

Related errors


AI-assisted analysis of upstash/context7@80e681a507 (2026-09-08). Data as JSON: /api/errors/97ac1cb2e6f67de4. Report an issue: GitHub.