fix(bridge): skip array properties in keyword-fallback toString() - #6
Open
steveonjava wants to merge 1 commit into
Open
fix(bridge): skip array properties in keyword-fallback toString()#6steveonjava wants to merge 1 commit into
steveonjava wants to merge 1 commit into
Conversation
Calling toString() on an embedding array property (type DoubleArray or
FloatArray) raises Neo.ClientError.Statement.TypeError in Neo4j, causing
HTTP 500 on any /memory/recall or /memory/query call after backfill_embeddings
has run.
Guard both _fallback_search_records and _fallback_query_records by excluding
known list-type keys ('embedding', 'vector') from the any(key IN keys(n) ...)
predicate before toString() is applied. Scalar string/number properties are
unaffected.
Fixes: keyword-fallback 500 on nodes with embedding property
steveonjava
marked this pull request as ready for review
August 10, 2026 05:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The bridge's keyword-fallback recall and query endpoints crash with HTTP 500 when any node carries an array-valued property. toString() is undefined for arrays in Neo4j, so the fallback's
any(key IN keys(n) WHERE toLower(toString(n[key])) CONTAINS $query)predicate fails as soon as the planner evaluates theembeddingkey.Root cause
Both
_fallback_search_records()and_fallback_query_records()inserver/main.pyiterate over all property keys without filtering out array-valued ones. Since the backend writesembeddingas a raw DoubleArray, this crashes on essentially every real memory graph.Fix
Added
NOT key IN ['embedding', 'vector']to theany(key IN keys(n) ...)predicate in both fallback functions. This excludes known list-type keys before toString() is applied.The fix is a hybrid rather than the obvious one-liner:
embedding/vectordenylist still crashes on any other list property that might appear in the future.valueType(n[key]) IS :: LIST<FLOAT>is crash-safe but silently drops matches for content that only exists inside a list.Test plan
npm run buildnpm run test:unitnpm run test:integrationnpm run test:e2eBehavior / compat notes