qishibo/AnotherRedisDesktopManager · warning
this.$t('message.json_format_failed')
Error message
this.$t('message.json_format_failed') What it means
Pure client-side validation: before sending JSON.SET, the component runs the edited text through $util.isJson (a JSON.parse check). 'json_format_failed' means the parse threw, so nothing is sent to Redis and the stored document is untouched. This is strict RFC 8259 JSON — JSON5/JS object literals are rejected.
Source
Thrown at src/components/contents/KeyContentReJson.vue:49
},
props: ['client', 'redisKey', 'hotKeyScope'],
components: { FormatViewer },
methods: {
initShow() {
this.client.callBuffer('JSON.GET', [this.redisKey]).then((reply) => {
this.content = reply;
});
},
execSave() {
const content = this.$refs.formatViewer.getContent();
// viewer check failed, do not save
if (content === false) {
return;
}
if (!this.$util.isJson(content)) {
return this.$message.error(this.$t('message.json_format_failed'));
}
this.client.call('JSON.SET', [this.redisKey, '$', content]).then((reply) => {
if (reply === 'OK') {
this.setTTL();
this.initShow();
this.$message.success({
message: this.$t('message.modify_success'),
duration: 1000,
});
} else {
this.$message.error({
message: this.$t('message.modify_failed'),
duration: 1000,
});
}
}).catch((e) => {View on GitHub (pinned to c149855106)
Solutions
- Click the format button or paste the text into a JSON linter to locate the offending offset
- Fix strict-JSON violations: double quotes everywhere, no trailing commas, no comments
- If the source is JSON5/relaxed JSON, convert it to strict JSON before saving
Defensive patterns
Strategy: validation
Validate before calling
try {
JSON.parse(content);
} catch (e) {
return this.$message.error(`Invalid JSON at: ${e.message}`);
} Type guard
function isJson(str) {
if (typeof str !== 'string' || !str.trim()) return false;
try { JSON.parse(str); return true; } catch (_) { return false; }
} Prevention
- Always validate with JSON.parse before JSON.SET — never trust edited textarea content
- Surface the parse error's position (e.message contains it) so users can find the bad offset
- Run a formatter before saving; formatting failure is itself the validation signal
When it happens
Trigger: Trailing commas, single-quoted strings, unquoted keys, comments, NaN/Infinity literals, or truncated text left in the viewer after editing; content pasted from JavaScript source rather than JSON.
Common situations: Documents produced by json.dumps with non-strict extensions; users pasting JS config objects; very large documents truncated by the viewer's size limit and then saved.
Related errors
- this.$t('message.json_format_failed')
- this.$t('message.json_format_failed')
- Raw content is an object, but now parse object failed: ${e.m
- Raw content is an object, but now parse object failed: ${e.m
- this.$t('message.json_format_failed')
AI-assisted analysis of qishibo/AnotherRedisDesktopManager@c149855106 (2026-08-22).
Data as JSON: /api/errors/6d0d79c4b47ea2a1.
Report an issue: GitHub.