{"record":{"id":"c5f756b955528aea","repo":"qishibo/AnotherRedisDesktopManager","slug":"err","errorCode":null,"errorMessage":"err","messagePattern":"err","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/components/viewers/ViewerCustom.vue","lineNumber":109,"sourceCode":"      );\n\n      // in case of long content in template\n      this.previewCommand = command.replace(\n        '{VALUE}',\n        this.$util.cutString(this.content.toString(), this.previewContentMax),\n      );\n\n      // if content is too long, write to file simultaneously\n      // hex str is about 2 times of real size\n      if (hexStr.length > this.writeHexFileSize) {\n        ipcRenderer.invoke('getTempPath').then((reply) => {\n          // target file name\n          const fileName = `ardm_cv_${this.redisKey.toString('hex')}`;\n          const filePath = require('path').join(reply, fileName);\n\n          require('fs').writeFile(filePath, hexStr, (err) => {\n            if (err) {\n              return this.$message.error(err);\n            }\n\n            this.fullCommand = this.fullCommand\n              .replace('{HEX_FILE}', filePath)\n              .replace('{HEX}', '<Content Too Long, Use {HEX_FILE} Instead!>');\n            this.previewCommand = this.previewCommand\n              .replace('{HEX_FILE}', filePath)\n              .replace('{HEX}', '<Content Too Long, Use {HEX_FILE} Instead!>');\n\n            this.exec();\n          });\n        });\n      }\n      // common content just exec\n      else {\n        this.fullCommand = this.fullCommand\n          .replace('{HEX}', hexStr)\n          .replace('{HEX_FILE}', '<Use {HEX} Instead!>');","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/qishibo/AnotherRedisDesktopManager/blob/c149855106628babcdfb7675a8e7ba9434d2492a/src/components/viewers/ViewerCustom.vue#L91-L127","documentation":"Element UI toast that forwards the Node fs error from writing the temporary hex file. When the edited value's hex length exceeds writeHexFileSize, ViewerCustom writes the hex string to a temp file (path from ipcRenderer 'getTempPath', named ardm_cv_<keyhex>) and substitutes {HEX_FILE} in the external command. fs.writeFile's callback receives a non-null err (front-of-callback Node convention) when the temp directory is unwritable, missing, or the path is invalid — the toast shows that err object/message and the command never executes.","triggerScenarios":"Editing a very large value in the custom viewer (hex string over the configured threshold) while the OS temp dir is not writable: TMPDIR pointing to a deleted directory, disk full, permissions changed, or antivirus locking temp writes on Windows; the getTempPath reply containing a path that does not exist in the renderer's context.","commonSituations":"CI/containers where /tmp is read-only or TMPDIR is stale; macOS with low disk space; running as a user without write access to the resolved temp path; leftover ardm_cv_* files accumulating until quota is hit.","solutions":["Check the message text — EACCES means fix permissions on the temp dir, ENOENT means recreate TMPDIR, ENOSPC means free disk space","Set TMPDIR to a writable location and restart the app","Clear old ardm_cv_* files from the temp directory","If it persists, raise writeHexFileSize so small-ish values stay inline via {HEX} instead of the temp-file path"],"exampleFix":"// before\nrequire('fs').writeFile(filePath, hexStr, (err) => {\n  if (err) {\n    return this.$message.error(err);\n  }\n  ...\n});\n\n// after - actionable message incl. path\nrequire('fs').writeFile(filePath, hexStr, (err) => {\n  if (err) {\n    return this.$message.error(`Cannot write ${filePath}: ${err.message}`);\n  }\n  ...\n});","handlingStrategy":"try-catch","validationCode":"// preflight: temp dir writable before launching the flow\nconst fs = require('fs');\nconst os = require('os');\nfs.accessSync(os.tmpdir(), fs.constants.W_OK);","typeGuard":null,"tryCatchPattern":"require('fs').writeFile(filePath, hexStr, (err) => {\\n  if (err) {\\n    // actionable message including the failing path\\n    this.$message.error(`Cannot write ${filePath}: ${err.message}`);\\n    return;\\n  }\\n  this.exec();\\n});","preventionTips":["Ensure TMPDIR exists and is writable; restart the app after changing it","Periodically clean accumulated ardm_cv_* temp files","Raise the writeHexFileSize threshold so moderate values stay inline"],"tags":["file-io","temp-file","node-fs","custom-viewer"],"backgroundTag":"temp-file-write-failed","analyzedSha":"c149855106628babcdfb7675a8e7ba9434d2492a","analyzedAt":"2026-08-22T09:06:28.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}