ruvnet/ruflo · error · Error
AIDefence failed to load: ${error.message}
Error message
AIDefence failed to load: ${error.message} What it means
Error "AIDefence failed to load: ${error.message}" thrown in ruvnet/ruflo.
Source
Thrown at v3/@claude-flow/cli/src/mcp-tools/security-tools.ts:69
}
const packageName = '@claude-flow/aidefence';
// First attempt - try to load via dynamic import (ESM)
try {
const aidefence = await import(packageName);
const instance = aidefence.createAIDefence({ enableLearning: true });
if (!instance) {
throw new Error('createAIDefence returned null');
}
aidefenceInstance = instance;
return instance;
} catch (e) {
// Package not found or failed to load
const error = e as Error;
if (!error.message?.includes('Cannot find package') && !error.message?.includes('ERR_MODULE_NOT_FOUND')) {
// Different error - might be a real issue
throw new Error(`AIDefence failed to load: ${error.message}`);
}
}
// Don't attempt install more than once per session
if (installAttempted) {
throw new Error('AIDefence package not available. Install with: npm install @claude-flow/aidefence');
}
installAttempted = true;
// Second attempt - auto-install and retry
console.error(`[claude-flow] ${packageName} not found, attempting auto-install...`);
const installed = await autoInstallPackage(packageName);
if (!installed) {
throw new Error('AIDefence package not available. Install with: npm install @claude-flow/aidefence');
}
// #1807 — auto-install lands the package somewhere Node's standardView on GitHub (pinned to 6b01dc5a68)
When it happens
Trigger: Thrown at v3/@claude-flow/cli/src/mcp-tools/security-tools.ts:69 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/bcd4d22f40ff31e8.
Report an issue: GitHub.