{"record":{"id":"d1731beeed7bc8ab","repo":"ruvnet/ruflo","slug":"dependencies-not-available","errorCode":null,"errorMessage":"Dependencies not available","messagePattern":"Dependencies not available","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"v3/@claude-flow/hooks/src/reasoningbank/index.ts","lineNumber":265,"sourceCode":"        });\n\n        await this.agentDB.initialize();\n        this.useRealBackend = true;\n\n        // Try to use real embedding service\n        if (EmbeddingServiceImpl && !this.config.useMockEmbeddings) {\n          try {\n            this.embeddingService = new RealEmbeddingService(this.config.dimensions);\n            await (this.embeddingService as RealEmbeddingService).initialize();\n          } catch (e) {\n            console.warn('[ReasoningBank] Real embeddings unavailable, using hash-based fallback');\n          }\n        }\n\n        await this.loadPatterns();\n        console.log(`[ReasoningBank] Initialized with AgentDB + HNSW (M=${this.config.hnswM}, efConstruction=${this.config.hnswEfConstruction})`);\n      } else {\n        throw new Error('Dependencies not available');\n      }\n\n      this.initialized = true;\n      this.emit('initialized', {\n        shortTermCount: this.shortTermPatterns.size,\n        longTermCount: this.longTermPatterns.size,\n        useRealBackend: this.useRealBackend,\n      });\n    } catch (error) {\n      // Fallback to in-memory only mode\n      console.warn('[ReasoningBank] AgentDB not available, using in-memory mode');\n      this.useRealBackend = false;\n      this.initialized = true;\n    }\n  }\n\n  /**\n   * Load optional dependencies","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/hooks/src/reasoningbank/index.ts#L247-L283","documentation":"ReasoningBank.initialize() dynamically imports the AgentDB adapter and HNSW index modules; when either fails to load it throws 'Dependencies not available'. Importantly, the surrounding catch swallows this throw and downgrades the bank to in-memory-only mode (useRealBackend = false), so in practice this error signals degraded capability — no vector persistence — rather than a crash. You mostly observe it via logs and the missing real backend.","triggerScenarios":"Calling await bank.initialize() in an environment where the @claude-flow/memory native/optional dependencies (AgentDB bindings, HNSW/ruvector NAPI modules) are not installed, not built for the platform, or excluded by the bundler's handling of the webpackIgnore'd dynamic import.","commonSituations":"Optional dependencies skipped during npm install --omit=optional or prune; native modules compiled for a different Node ABI or OS (deploying to Alpine/containers); bundlers statically resolving and dropping the dynamic import; CI passing with in-memory mode unnoticed while production silently loses persistence.","solutions":["Install the optional/native dependencies the adapter loads (@claude-flow/memory and its HNSW bindings) in the target environment","After initialize(), check the 'initialized' event's useRealBackend flag and fail loudly in environments that require persistence","If in-memory operation is acceptable for that deployment, treat the console warning as expected and document it"],"exampleFix":"// before\nconst bank = new ReasoningBank();\nawait bank.initialize(); // native deps missing -> silently degrades to in-memory\n\n// after\nconst bank = new ReasoningBank();\nbank.on('initialized', (info) => {\n  if (!info.useRealBackend && process.env.REQUIRE_VECTOR_BACKEND === '1') {\n    throw new Error('ReasoningBank fell back to in-memory mode; install @claude-flow/memory native deps');\n  }\n});\nawait bank.initialize();","handlingStrategy":"fallback","validationCode":"// Detect the degraded mode explicitly instead of relying on the swallowed throw\nconst bank = new ReasoningBank();\nbank.on('initialized', (info: { useRealBackend: boolean }) => {\n  if (!info.useRealBackend && process.env.REQUIRE_VECTOR_BACKEND === '1') {\n    throw new Error('ReasoningBank is in-memory only; native AgentDB/HNSW deps did not load');\n  }\n});\nawait bank.initialize();","typeGuard":null,"tryCatchPattern":"// initialize() already catches internally; wrap to observe capability only\ntry {\n  await bank.initialize();\n} finally {\n  const real = /* from the 'initialized' event payload */ useRealBackend;\n  if (!real) logger.warn('ReasoningBank degraded: in-memory mode (no vector persistence)');\n}","preventionTips":["Install and build the optional native dependencies in the deployment image, not just dev","Assert useRealBackend after initialize() in environments that require persistence","Test deploys in the same runtime/architecture as production so native modules actually load"],"tags":["reasoningbank","hooks","optional-dependency","native-module","graceful-degradation"],"backgroundTag":"missing-optional-dependency","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}