qishibo/AnotherRedisDesktopManager · warning

this.$t('message.json_format_failed')

Error message

this.$t('message.json_format_failed')

What it means

Application-level validation toast ('Json Parse Failed') in KeyContentStream.vue:333. Before saving an edited stream entry, editLine() runs $util.isJson(afterValue); if the editor content is not parseable JSON the XADD is never sent. This exists because the stream editor models entry fields as a JSON object (JSON.parse + flattened field/value pairs into mapList for xadd), so non-JSON content cannot be represented.

Source

Thrown at src/components/contents/KeyContentStream.vue:333

        }

        return `${command} ${dicts.join(' ')}`;
      });

      // reverse: id asc order
      this.$util.copyToClipboard(params.reverse().join('\n'));
      this.$message.success({ message: this.$t('message.copy_success'), duration: 800 });
    },
    editLine() {
      const afterId = this.editLineItem.id;
      const afterValue = this.$refs.formatViewer.getContent();

      if (!afterId || !afterValue) {
        return;
      }

      if (!this.$util.isJson(afterValue)) {
        return this.$message.error(this.$t('message.json_format_failed'));
      }

      const mapList = [];
      const jsonObj = JSON.parse(afterValue);

      for (const k in jsonObj) {
        mapList.push(...[k, jsonObj[k]]);
      }

      this.client.xadd(
        this.redisKey,
        afterId,
        mapList,
      ).then((reply) => {
        // reply is id
        if (reply) {
          // this.initShow(); // do not reinit, #786
          const newLine = { id: reply, content: jsonObj, contentString: afterValue };

View on GitHub (pinned to c149855106)

Solutions

  1. Run the content through a strict JSON validator (jsonlint) and fix highlighted spots — keys in double quotes, no trailing commas
  2. Use the format button in the viewer to auto-pretty-print valid JSON before editing
  3. If the original entry is not valid JSON, edit it as a whole-string strategy or rewrite it via console XADD
  4. Ensure the value is an object at top level, not an array or scalar, so field/value pairs can be derived

Example fix

// before
if (!this.$util.isJson(afterValue)) {
  return this.$message.error(this.$t('message.json_format_failed'));
}
const jsonObj = JSON.parse(afterValue);

// after: show why parsing failed and require a plain object
let jsonObj = null;
try { jsonObj = JSON.parse(afterValue); } catch (e) {
  return this.$message.error(`${this.$t('message.json_format_failed')}: ${e.message}`);
}
if (!jsonObj || jsonObj.constructor !== Object || Array.isArray(jsonObj)) {
  return this.$message.error(this.$t('message.json_format_failed'));
}
Defensive patterns

Strategy: type-guard

Validate before calling

const parsed = tryParseJson(afterValue);
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
  return this.$message.error(this.$t('message.json_format_failed'));
}

Type guard

// narrows editor text to a JSON plain object suitable for XADD field pairs
function tryParseJson(text) {
  try {
    const v = JSON.parse(text);
    return v !== null && typeof v === 'object' && !Array.isArray(v) ? v : null;
  } catch (e) {
    return null;
  }
}

Try / catch

let jsonObj;
try { jsonObj = JSON.parse(afterValue); }
catch (e) { return this.$message.error(`${this.$t('message.json_format_failed')}: ${e.message}`); }

Prevention

When it happens

Trigger: Triggered when the editor content has trailing commas, single quotes, unquoted keys, comments, or a truncated paste; when editing an entry whose stored contentString was not valid JSON in the first place (field names collide or binary-ish values broke round-trip); or when autoFormat produced an empty/placeholder buffer.

Common situations: Hand-editing copied stream payloads; entries serialized by producers using non-strict JSON; large payloads where the monaco editor content was only partially loaded; newline/trailing whitespace accidents.

Related errors


AI-assisted analysis of qishibo/AnotherRedisDesktopManager@c149855106 (2026-08-22). Data as JSON: /api/errors/1c1fcc89e588aa1e. Report an issue: GitHub.