{"record":{"id":"8e1d8873a81104d1","repo":"ruvnet/ruflo","slug":"ruvbot-does-not-export-createaidefenceguard-ensur","errorCode":null,"errorMessage":"ruvbot does not export createAIDefenceGuard. Ensure ruvbot@0.1.8 or later is installed.","messagePattern":"ruvbot does not export createAIDefenceGuard\\. Ensure ruvbot@0\\.1\\.8 or later is installed\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/guidance/src/ruvbot-integration.ts","lineNumber":248,"sourceCode":"    };\n  }\n\n  /**\n   * Lazily initialize the underlying ruvbot AIDefence guard.\n   * Safe to call multiple times; only the first call creates the guard.\n   */\n  private async ensureGuard(): Promise<RuvBotAIDefenceGuard> {\n    if (this.guard) return this.guard;\n\n    if (!this.guardInitPromise) {\n      this.guardInitPromise = (async () => {\n        const mod = await requireRuvBot();\n        const createGuard = mod['createAIDefenceGuard'] as\n          | ((config?: Record<string, unknown>) => RuvBotAIDefenceGuard)\n          | undefined;\n\n        if (typeof createGuard !== 'function') {\n          throw new Error(\n            'ruvbot does not export createAIDefenceGuard. ' +\n            'Ensure ruvbot@0.1.8 or later is installed.',\n          );\n        }\n\n        this.guard = createGuard({\n          detectPromptInjection: this.config.detectPromptInjection,\n          detectJailbreak: this.config.detectJailbreak,\n          detectPII: this.config.detectPII,\n        });\n      })();\n    }\n\n    await this.guardInitPromise;\n    return this.guard!;\n  }\n\n  /**","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/guidance/src/ruvbot-integration.ts#L230-L266","documentation":"After the ruvbot module imports successfully, the integration looks up mod.createAIDefenceGuard and requires it to be a function before building the guard. An installed-but-old ruvbot (pre-0.1.8) or a different package occupying the 'ruvbot' name lacks that export, so this distinct 'wrong version' error fires even though the package resolved fine. The guard initialization promise is cached, so a failed init retries on next use.","triggerScenarios":"A stale ruvbot from an old lockfile (version < 0.1.8) resolving correctly but exporting no createAIDefenceGuard; a same-named private/forked package installed in its place; partial upgrades where ruvbot was pinned years ago.","commonSituations":"Lockfiles keeping ancient optional deps; corporate registries serving a different 'ruvbot'; upgrading @claude-flow/guidance without re-checking its peer version requirements.","solutions":["Upgrade to a compatible release: npm install ruvbot@^0.1.8 (or latest)","Verify the export exists in the installed version: node -e \"import('ruvbot').then(m => console.log(typeof m.createAIDefenceGuard))\" — should print 'function'","Pin ruvbot in package.json so lockfile drift cannot resurrect an old version","If the export is genuinely absent in your fork, disable the AIDefenceGate integration instead of retrying"],"exampleFix":"# before\nnpm ls ruvbot # ruvbot@0.1.1 — no createAIDefenceGuard export\n# after\nnpm install ruvbot@0.1.8\nnode -e \"import('ruvbot').then(m => console.log(typeof m.createAIDefenceGuard))\" # function","handlingStrategy":"type-guard","validationCode":"const mod = (await import('ruvbot')) as Record<string, unknown>;\nif (typeof mod['createAIDefenceGuard'] !== 'function') {\n  throw new Error('Installed ruvbot is too old; run: npm install ruvbot@0.1.8');\n}\nconst guard = (mod['createAIDefenceGuard'] as () => RuvBotAIDefenceGuard)();","typeGuard":"function exportsCreateAIDefenceGuard(mod: Record<string, unknown>): boolean {\n  return typeof mod['createAIDefenceGuard'] === 'function';\n}","tryCatchPattern":"try {\n  const gate = new AIDefenceGate({});\n} catch (err) {\n  if (err instanceof Error && err.message.includes('does not export createAIDefenceGuard')) {\n    throw new Error('ruvbot version mismatch: upgrade with npm install ruvbot@0.1.8');\n  }\n  throw err;\n}","preventionTips":["Pin ruvbot@^0.1.8 in package.json so lockfiles cannot keep a pre-export version","Verify typeof (await import('ruvbot')).createAIDefenceGuard === 'function' in smoke tests","Beware same-named packages on private registries shadowing npm's ruvbot"],"tags":["guidance","ruvbot","version-mismatch","missing-export","integration"],"backgroundTag":"incompatible-package-version","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}