Skip to content

fix(client): return null for a missing vector set key or element - #3534

Closed
rome-xi wants to merge 1 commit into
redis:masterfrom
rome-xi:contrib/node-redis-3533
Closed

rome-xi wants to merge 1 commit into
redis:masterfrom
rome-xi:contrib/node-redis-3533

Conversation

@rome-xi

@rome-xi rome-xi commented Oct 23, 2026 •

Copy link
Copy Markdown

A missing vector set key or element is a nil reply. vEmbRaw() threw on RESP2 and RESP3 because its transform read reply[0]. On RESP2, vEmb() mapped the reply, vInfo() read reply.length, and vLinksWithScores() iterated it, so those threw as well. vLinks() already returned null.

The four transforms now return null for a nil reply. The vEmb() check lives in VEMB.ts rather than the shared double-array helper, which t-digest also uses. Reply types include null (NullReply on the RESP3 pass-through). Non-nil replies are unchanged.

Nil-reply cases sit in the existing command specs and call transformReply(null) on both protocols. They fail on master and pass with this change. npx tsc --noEmit -p packages/client is clean.

Fixes #3533


Note

Low Risk
Localized reply-transform and typing changes for vector-set commands; successful replies are unchanged and behavior matches Redis nil semantics.

Overview
Fixes nil replies for vector-set commands when a key or element is missing: vEmb, vEmbRaw, vInfo, and vLinksWithScores now return null instead of throwing during reply transforms (aligned with existing vLinks() behavior).

VEMB wraps the shared double-array transformer with a local null guard so other consumers (e.g. t-digest) are unchanged. Reply typings now include null on RESP2 and RESP3. Unit tests cover transformReply(null) and a compile-time types test guards issue #3533.

Reviewed by Cursor Bugbot for commit e84e631. Bugbot is set up for automated code reviews on this repo. Configure here.

Signed-off-by: rome-xi <rome-xi@users.noreply.github.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-23T06:30:35.227986Z
We couldn’t complete this review. Comment @codex review to try again.
e84e631 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@nkaradzhov

Copy link
Copy Markdown
Collaborator

Thanks for this, @rome-xi. The fix is correct, but the issue author offered to work on it before this PR opened, so we're giving them the first chance. I've explained more in #3533. Closing this one.

@rome-xi

rome-xi commented Oct 23, 2026

Copy link
Copy Markdown
Author

Makes sense, thanks for explaining. Happy for the issue author to take it, and feel free to reuse any of the tests here if they help.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vector set commands throw a TypeError instead of returning null for a missing key or element

2 participants