Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#15886·Redis

[NEW] Validate the attribute JSON in VSETATTR and VADD SETATTR

Author: LauriantiCreated Sep 28, 2026Updated Sep 28, 2026

The problem/use-case that the feature addresses

The VSETATTR page promised an error reply for an improperly specified attribute string, but the code does not validate it; redis/docs#4129 aligned the page to the code. This issue proposes the other way round: making the code validate.

VSETATTR, and VADD with SETATTR, store the attribute string as given, even when it is not valid JSON, and reply as if it were:

$ redis-cli VADD s VALUES 2 1 0 a SETATTR '{broken'
1
$ redis-cli VADD s VALUES 2 0 1 b SETATTR '{"x":1}'
1
$ redis-cli VSIM s VALUES 2 1 1 FILTER '.x != 5'
b

Checked at 20bb2cfc5. The mistake shows up only later, when FILTER treats the element as not matching, with no error.

Description of the feature

Reply with an error when the attribute string is not valid JSON, in VSETATTR and in VADD ... SETATTR, without changing the set. An empty string keeps deleting the attributes.

Alternatives you've considered

Keeping the current behavior, now documented in redis/docs#4129. Validating changes it: a call that succeeds today would fail, so it could also be an option of the command instead of the default.

Additional information

I can send the PR for this.

Source: redis/redis

View original on GitHubView discussion on GitHub