qishibo/AnotherRedisDesktopManager · warning

File parse failed.

Error message

File parse failed.

What it means

Import-keys flow in ConnectionMenu.vue: the chosen file is read line-by-line (readline Interface) and each line is processed as a key import; on 'close', if count === 0 - not a single line was ever emitted - the app shows 'File parse failed.' and nothing is imported (count only reaches zero lines for an empty/unreadable-as-text file).

Source

Thrown at src/components/ConnectionMenu.vue:294

          content = Buffer.from(content, 'hex');
          ttl = ttl > 0 ? ttl : 0;

          // fix #1213, REPLACE can be used in Redis>=3.0
          this.client.callBuffer('RESTORE', key, ttl, content, 'REPLACE').then((reply) => {
            // reply == 'OK'
            succ.push(key);
          }).catch((e) => {
            fail.push(key);
          }).finally(() => {
            this.$set(this.$refs.importKeysNotify,
              'innerHTML',
              `Succ: ${succ.length}, Fail: ${fail.length}`);
          });
        });

        rl.on('close', () => {
          if (count === 0) {
            return this.$message.error('File parse failed.');
          }

          (count > 10000) && this.$message.success({
            message: this.$t('message.import_success'),
            duration: 800,
          });

          // refresh keu list
          this.$bus.$emit('refreshKeyList', this.client);
        });
      });
    },
    execFileCMDS() {
      remote.dialog.showOpenDialog(remote.getCurrentWindow(), {
        properties: ['openFile'],
      }).then((reply) => {
        if (reply.canceled) {
          return;

View on GitHub (pinned to c149855106)

Solutions

  1. Open the file in a text editor and confirm it is plain text with one key per line (UTF-8).
  2. If it is empty, re-export or rebuild the key list file and retry the import.
  3. Watch the Succ/Fail counters in the notification during a successful import - they update per line, confirming lines are being read.

Example fix

// before
rl.on('close', () => {
  if (count === 0) return this.$message.error('File parse failed.');
});

// after - fail fast on an empty file before starting
const stat = fs.statSync(file);
if (stat.size === 0) return this.$message.error('File is empty - nothing to import.');
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs');
// validate before import starts
const raw = fs.readFileSync(file, 'utf8');
const lines = raw.split('\n').filter((l) => l.trim().length > 0);
if (lines.length === 0) throw new Error('No importable lines in file');

Type guard

const isImportableText = (raw) => raw.split('\n').some((l) => l.trim().length > 0);

Try / catch

rl.on('close', () => {
  if (count === 0) {
    // file-level problem: abort cleanly, show which file, do not emit refreshKeyList
    this.$message.error(`No lines parsed from ${file.path}`);
  }
});

Prevention

When it happens

Trigger: Selecting an empty file (0 bytes); a file containing only a trailing newline/whitespace; accidentally picking a binary or wrong file; a file created by a failed or empty export.

Common situations: Export from another tool produced an empty file; wrong file grabbed from a downloads folder; file saved with no content due to a previous crash.


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