{"record":{"id":"dc5065a53db6188d","repo":"qishibo/AnotherRedisDesktopManager","slug":"file-parse-failed","errorCode":null,"errorMessage":"File parse failed.","messagePattern":"File parse failed\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/components/ConnectionMenu.vue","lineNumber":294,"sourceCode":"          content = Buffer.from(content, 'hex');\n          ttl = ttl > 0 ? ttl : 0;\n\n          // fix #1213, REPLACE can be used in Redis>=3.0\n          this.client.callBuffer('RESTORE', key, ttl, content, 'REPLACE').then((reply) => {\n            // reply == 'OK'\n            succ.push(key);\n          }).catch((e) => {\n            fail.push(key);\n          }).finally(() => {\n            this.$set(this.$refs.importKeysNotify,\n              'innerHTML',\n              `Succ: ${succ.length}, Fail: ${fail.length}`);\n          });\n        });\n\n        rl.on('close', () => {\n          if (count === 0) {\n            return this.$message.error('File parse failed.');\n          }\n\n          (count > 10000) && this.$message.success({\n            message: this.$t('message.import_success'),\n            duration: 800,\n          });\n\n          // refresh keu list\n          this.$bus.$emit('refreshKeyList', this.client);\n        });\n      });\n    },\n    execFileCMDS() {\n      remote.dialog.showOpenDialog(remote.getCurrentWindow(), {\n        properties: ['openFile'],\n      }).then((reply) => {\n        if (reply.canceled) {\n          return;","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/qishibo/AnotherRedisDesktopManager/blob/c149855106628babcdfb7675a8e7ba9434d2492a/src/components/ConnectionMenu.vue#L276-L312","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open the file in a text editor and confirm it is plain text with one key per line (UTF-8).","If it is empty, re-export or rebuild the key list file and retry the import.","Watch the Succ/Fail counters in the notification during a successful import - they update per line, confirming lines are being read."],"exampleFix":"// before\nrl.on('close', () => {\n  if (count === 0) return this.$message.error('File parse failed.');\n});\n\n// after - fail fast on an empty file before starting\nconst stat = fs.statSync(file);\nif (stat.size === 0) return this.$message.error('File is empty - nothing to import.');","handlingStrategy":"validation","validationCode":"const fs = require('fs');\n// validate before import starts\nconst raw = fs.readFileSync(file, 'utf8');\nconst lines = raw.split('\\n').filter((l) => l.trim().length > 0);\nif (lines.length === 0) throw new Error('No importable lines in file');","typeGuard":"const isImportableText = (raw) => raw.split('\\n').some((l) => l.trim().length > 0);","tryCatchPattern":"rl.on('close', () => {\n  if (count === 0) {\n    // file-level problem: abort cleanly, show which file, do not emit refreshKeyList\n    this.$message.error(`No lines parsed from ${file.path}`);\n  }\n});","preventionTips":["Pre-scan the file for at least one non-empty line before starting the import.","Standardize exports as UTF-8, one key per line.","Show the parsed line count in the UI before committing to the import."],"tags":["import","file-format","readline","empty-file"],"backgroundTag":"file-parse-failed","analyzedSha":"c149855106628babcdfb7675a8e7ba9434d2492a","analyzedAt":"2026-08-22T09:06:28.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}