Skip to content

Vector search errors on deleted indexed node until restart (Community 3.13.1) #4975

Open

Description

@oyatek

Version and environment

Memgraph Community 3.13.1 (latest stable release, 2026-09-14), official memgraph/memgraph OCI index digest sha256:bd3fe13228f40881365486729c78110dde6e04f3c1f102c84720d31f38b693f8; Ubuntu 24.04 x86-64. Storage mode IN_MEMORY_TRANSACTIONAL, WAL enabled. Each scenario used a separate fresh data directory.

Minimal reproduction

Use a 64-dimensional unit vector $a = [1,0,...,0] and run these queries in order:

CREATE VECTOR INDEX repro_vector ON :Repro(embedding)
  WITH CONFIG {"dimension":64,"capacity":128,"metric":"cos"};
CREATE (:Repro {applicationId:"original",embedding:$a});
CALL vector_search.search("repro_vector",10,$a) YIELD node
RETURN id(node),node.applicationId; // baseline: original
MATCH (n:Repro {applicationId:"original"}) DETACH DELETE n;
CALL vector_search.search("repro_vector",10,$a) YIELD node
RETURN id(node),node.applicationId; // actual: error

Expected: the last search returns zero rows. Actual: Trying to get properties from a deleted object. A search against a different vector also raises the same error. A clean process restart makes both searches return zero rows.

Two separate fresh-volume variants also fail immediately after delete: create a new indexed node with a different application ID, or recreate with the same application ID. In each, the original internal ID was 0, a non-indexed sentinel was 1, and the new indexed node had internal ID 2; search for the new vector raised the same error. After clean restart it returned the new node. In-place SET n.embedding=$b without delete worked both immediately and after restart, with a second control vector proving the new embedding ranked first.

Is deletion supposed to remove the vector-index entry synchronously, and is there a supported fix in a released version?

Activity

  1. tae898 commented on Oct 2, 2026

    @tae898

    A data point from the same release (3.13.1, memgraph/memgraph@sha256:4710bee1…, IN_MEMORY_TRANSACTIONAL, default config), in case it helps: in my runs the error clears without a restart once the storage garbage collector runs. After MATCH ... DELETE commits, vector_search.search raised Trying to get a property from a deleted object. immediately and 2 s later, but returned the right nodes 35 s later, past the default storage_gc_cycle_sec of 30. Running FREE MEMORY right after the delete clears it at once, which is what my benchmark does after each timed delete for now.

    Reproduction, with the neo4j Python driver against a fresh server:

    import sys, time
    from neo4j import GraphDatabase
    d = GraphDatabase.driver(f"bolt://{sys.argv[1]}:7687", auth=None)
    def search(s):
        return s.run("CALL vector_search.search('art', 5, [0.0, 0.0]) YIELD node, distance RETURN node.vid AS vid").data()
    with d.session() as s:
        s.run("UNWIND range(0, 99) AS i CREATE (:Article {vid: i, embedding: [toFloat(i), 0.0]})").consume()
        s.run('CREATE VECTOR INDEX art ON :Article(embedding) WITH CONFIG {"dimension": 2, "capacity": 200, "metric": "l2sq", "scalar_kind": "f32"}').consume()
        s.run("MATCH (a:Article) WHERE a.vid IN [0, 1, 2] DELETE a").consume()
        for label, wait in (("immediately", 0), ("after 2 s", 2), ("after 35 s", 33)):
            time.sleep(wait)
            try: print(label, [r["vid"] for r in search(s)])
            except Exception as e: print(label, "ERROR", e)

    Output: immediately ERROR ... deleted object, after 2 s ERROR ..., after 35 s [3, 4, 5, 6, 7]. With FREE MEMORY after the delete instead of waiting, the first search already returns [3, 4, 5, 6, 7].

  2. oyatek commented on Oct 2, 2026

    @oyatek
    Author

    Thanks a lot for testing this and sharing the GC / FREE MEMORY behavior — that’s very helpful. It strongly suggests the issue is tied to delayed cleanup of deleted vector-index entries rather than persistent index corruption.

    We’ll take this into account in our evaluation and will also test the maintenance/GC path explicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions