ruvnet/ruflo · error · Error

AIDefence installed but failed to load: ${retryError}. This

Error message

AIDefence installed but failed to load: ${retryError}.
This usually means npm installed the package somewhere Node's module resolver doesn't search (common with global installs of `claude-flow`). Recovery options:
  1. Run `npm install --save @claude-flow/aidefence` in your project's working directory.
  2. Or run `npx ruflo@latest mcp start` from a directory whose node_modules contains the package.
  3. Or restart the MCP server after the install completes.

What it means

Error "AIDefence installed but failed to load: ${retryError}. This usually means npm installed the package somewhere Node's module resolver doesn't search (common with global installs of `claude-flow`). Recovery options: 1. Run `npm install --save @claude-flow/aidefence` in your project's working directory. 2. Or run `npx ruflo@latest mcp start` from a directory whose node_modules contains the package. 3. Or restart the MCP server after the install completes." thrown in ruvnet/ruflo.

Source

Thrown at v3/@claude-flow/cli/src/mcp-tools/security-tools.ts:120

      return instance;
    }
  } catch { /* fall through to file:// attempt */ }

  // file:// + cache-bust attempt (covers globally-installed packages whose
  // path the standard resolver missed but require.resolve can locate).
  try {
    const modulePath = require.resolve(packageName);
    const cacheBust = `?t=${Date.now()}`;
    const aidefence = await import(`file://${modulePath}${cacheBust}`);
    const instance = aidefence.createAIDefence({ enableLearning: true });
    if (!instance) {
      throw new Error('createAIDefence returned null after install');
    }
    aidefenceInstance = instance;
    console.error(`[claude-flow] ${packageName} loaded after install (file:// path)`);
    return instance;
  } catch (retryError) {
    throw new Error(
      `AIDefence installed but failed to load: ${retryError}.\n` +
      `This usually means npm installed the package somewhere Node's module resolver doesn't search ` +
      `(common with global installs of \`claude-flow\`). Recovery options:\n` +
      `  1. Run \`npm install --save @claude-flow/aidefence\` in your project's working directory.\n` +
      `  2. Or run \`npx ruflo@latest mcp start\` from a directory whose node_modules contains the package.\n` +
      `  3. Or restart the MCP server after the install completes.`
    );
  }
}

/**
 * Scan input for AI manipulation threats
 */
const aidefenceScanTool: MCPTool = {
  name: 'aidefence_scan',
  description: 'Scan input text for AI manipulation threats (prompt injection, jailbreaks, PII). Returns threat assessment with <10ms latency. Use when nothing native exists — Claude Code does not have a PII / prompt-injection / adversarial-text scanner. Pair with any tool that ingests untrusted input (browser scrape, federation envelope, memory_import_claude).',
  inputSchema: {
    type: 'object',

View on GitHub (pinned to 6b01dc5a68)

When it happens

Trigger: Thrown at v3/@claude-flow/cli/src/mcp-tools/security-tools.ts:120 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruvnet/ruflo@6b01dc5a68 (2026-08-12). Data as JSON: /api/errors/4bf54e403df677e6. Report an issue: GitHub.