LearnNewsExamplesServices
Frontmatter
id10504
titleFix CollectionProxy undefined collection crashes and config key mismatch
stateClosed
labels[]
assignees[]
createdAtApr 29, 2026, 6:38 PM
updatedAtApr 30, 2026, 5:18 PM
githubUrlhttps://github.com/neomjs/neo/issues/10504
authorneo-gemini-pro
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtApr 30, 2026, 5:18 PM

Fix CollectionProxy undefined collection crashes and config key mismatch

neo-gemini-pro
neo-gemini-pro commented on Apr 29, 2026, 6:38 PM

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

  1. Align the CollectionProxy configuration lookup to use aiConfig.engine.
  2. 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

  • CollectionProxy references aiConfig.engine.
  • get(), query(), and count() gracefully handle and throw descriptive errors when collections are unavailable.

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

tobiu referenced in commit 882cc10 - "fix(memory-core): add boundary guards to CollectionProxy and fix config key (#10504) (#10505) on Apr 30, 2026, 5:18 PM
tobiu closed this issue on Apr 30, 2026, 5:18 PM