Context
The CollectionProxy.mjs class in the Memory Core was misconfigured, expecting aiConfig.architecture instead of the canonical aiConfig.engine defined in config.mjs.
The Problem
Because of the config key mismatch, the manager arrays were not properly initialized for Chroma-backed or Hybrid environments. Furthermore, critical collection methods like get(), query(), and count() lacked defensive bounds checking. They blindly accessed collections[0], leading to TypeError: Cannot read properties of undefined when the getCollections() promise resolved to an empty array.
The Architectural Reality
ai/mcp/server/memory-core/config.mjs defines engine: 'hybrid' | 'chroma'.
ai/mcp/server/memory-core/managers/CollectionProxy.mjs was referencing aiConfig.architecture.
The Fix
- Align the
CollectionProxy configuration lookup to use aiConfig.engine.
- Add explicit boundary guards in
get(), query(), and count() to throw informative errors ([CollectionProxy] method() failed: No underlying collection available) instead of raw TypeErrors.
Acceptance Criteria
Avoided Traps / Gold Standards Rejected
- Optional Chaining Only (
collections[0]?.count()): Rejected because returning undefined for a database count/query operation masks the underlying connection failure from the orchestrator. Throwing a descriptive error ensures the agent receives immediate feedback that the database proxy failed.
Origin Session ID: df8049d8-56ad-417b-ae0e-17a38e22a0ae
Context
The
CollectionProxy.mjsclass in the Memory Core was misconfigured, expectingaiConfig.architectureinstead of the canonicalaiConfig.enginedefined inconfig.mjs.The Problem
Because of the config key mismatch, the manager arrays were not properly initialized for Chroma-backed or Hybrid environments. Furthermore, critical collection methods like
get(),query(), andcount()lacked defensive bounds checking. They blindly accessedcollections[0], leading toTypeError: Cannot read properties of undefinedwhen thegetCollections()promise resolved to an empty array.The Architectural Reality
ai/mcp/server/memory-core/config.mjsdefinesengine: 'hybrid' | 'chroma'.ai/mcp/server/memory-core/managers/CollectionProxy.mjswas referencingaiConfig.architecture.The Fix
CollectionProxyconfiguration lookup to useaiConfig.engine.get(),query(), andcount()to throw informative errors ([CollectionProxy] method() failed: No underlying collection available) instead of rawTypeErrors.Acceptance Criteria
CollectionProxyreferencesaiConfig.engine.get(),query(), andcount()gracefully handle and throw descriptive errors when collections are unavailable.Avoided Traps / Gold Standards Rejected
collections[0]?.count()): Rejected because returningundefinedfor a database count/query operation masks the underlying connection failure from the orchestrator. Throwing a descriptive error ensures the agent receives immediate feedback that the database proxy failed.Origin Session ID: df8049d8-56ad-417b-ae0e-17a38e22a0ae