Skip to content

Native build: saving a find_nearest(include_vector=True) hit fails with 'Object of type RID is not JSON serializable' #265

Closed

Description

@tae898

On main (a53f9cd6cc), the native build fails to save a record that find_nearest(..., include_vector=True) returned. Found by the parity leg of #264 (linux-x86_64, Python 3.12), in a test that passed on each PR of the batch on its own:

FAILED tests/test_vector_hit_records.py::test_a_hit_can_be_modified_and_saved[True] - TypeError: Object of type RID is not JSON serializable
  records.py:371 _save_update: db.query("sql", self._SELECT, {"rid": RID(self._rid)})
  codec.py:217 encode_params: text = _dumps({"named": out})

Cause: a hit of find_nearest(include_vector=True) carries the row's RID as its rid, and the native record wrappers wrap their rid again (RID(self._rid) in save, the update, delete, new_edge and the edge reads). RID.__init__ stores its argument as is, so the result is an RID whose .text is an RID. The fast named-parameter path of codec.encode_params writes {TAG: ["R", v.text]} straight into the JSON text, and json cannot encode the inner RID. Reproduced without the engine:

encode_params([{"rid": RID("#1:2")}], binary=True)        # ok
encode_params([{"rid": RID(RID("#1:2"))}], binary=True)   # TypeError: Object of type RID is not JSON serializable

The slower paths (a named map with a non-plain value, positional parameters) go through the default hook, which calls itself for the inner RID and sends a nested tag instead of failing.

Affected: the native wheel (arcadedb) only, every write or edge call on a record whose rid is an RID object (a hit with include_vector=True is the one found). The JVM wheel is not affected. This blocks the 26.11.1 tag (#18): the release must not ship it.

Activity

  1. added
    performanceSpeed or memory of the bindings, with a measurement
    vectorVector indexes and find_nearest
    in progressThe team is actively working on this issue
    on Nov 5, 2026
  2. added this to the 26.11.1 milestone on Nov 5, 2026
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

    bugSomething isn't workingin progressThe team is actively working on this issueperformanceSpeed or memory of the bindings, with a measurementvectorVector indexes and find_nearest

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions