qishibo/AnotherRedisDesktopManager · warning
Attributes must be valid JSON
Error message
Attributes must be valid JSON
What it means
The optional attributes field failed the isJson check, so VADD ... SETATTR is never sent. SETATTR expects a JSON object; the client refuses malformed JSON client-side, mirroring error 103 but for the attribute box.
Source
Thrown at src/components/contents/KeyContentVector.vue:361
}
},
editLine() {
const before = this.beforeEditItem;
const element = (this.editLineItem.element || '').trim();
const vector = this.parseVectorText(this.editLineItem.vectorText);
const attrs = (this.editLineItem.attrs || '').trim();
if (!element) {
return this.$message.error('Element is required');
}
if (!vector || !vector.length) {
return this.$message.error('Vector is required');
}
if (this.dim && vector.length !== this.dim) {
return this.$message.error(`Vector dimension must be ${this.dim}`);
}
if (attrs && !this.$util.isJson(attrs)) {
return this.$message.error('Attributes must be valid JSON');
}
this.editDialog = false;
const vaddArgs = [this.redisKey, 'VALUES', vector.length, ...vector, element];
// must match existing set quant-type, otherwise: ERR asked quantization mismatch
const quantOpt = this.getQuantOption();
quantOpt && vaddArgs.push(quantOpt);
// set attributes
attrs && vaddArgs.push('SETATTR', attrs);
this.client.call('VADD', ...vaddArgs).then(() => {
if (this.isEdit) {
this.$message.success({ message: this.$t('message.modify_success'), duration: 1000 });
} else {
this.vectorData.push({ element });
this.total++;View on GitHub (pinned to c149855106)
Solutions
- Use strict JSON: double-quoted keys and string values, no trailing commas
- Validate the attributes in a JSON linter before saving
Defensive patterns
Strategy: validation
Validate before calling
if (attrs && !isJson(attrs)) {
return this.$message.error('Attributes must be valid JSON');
}
function isJson(str) {
try { JSON.parse(str); return true; } catch (_) { return false; }
} Type guard
function isJsonObject(str) {
if (typeof str !== 'string' || !str.trim()) return false;
try { const v = JSON.parse(str); return v !== null && typeof v === 'object' && !Array.isArray(v); } catch (_) { return false; }
} Prevention
- Validate optional JSON fields exactly like required ones — an empty value is fine, a malformed one is not
- Lint attributes with JSON.parse and show the parse position on failure
- Accept only objects for SETATTR to match Redis expectations
When it happens
Trigger: Single-quoted keys, unquoted keys, trailing commas in the attributes box; a half-edited object; pasting Python dict syntax.
Common situations: Metadata pasted from Python dicts or YAML; quick edits leaving a dangling comma.
Related errors
- Element is required
- Vector is required
- this.$t('message.json_format_failed')
- this.$t('message.json_format_failed')
- this.$t('message.json_format_failed')
AI-assisted analysis of qishibo/AnotherRedisDesktopManager@c149855106 (2026-08-22).
Data as JSON: /api/errors/0d56bee7da4d034d.
Report an issue: GitHub.