{"record":{"id":"fb6d8af7893cc01e","repo":"qishibo/AnotherRedisDesktopManager","slug":"error-err-discard-without-multi","errorCode":null,"errorMessage":"(error) ERR DISCARD without MULTI","messagePattern":"\\(error\\) ERR DISCARD without MULTI","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/components/CliTab.vue","lineNumber":222,"sourceCode":"        return this.content = [];\n      }\n\n      // mock help command\n      if (paramsArr[0] == 'help') {\n        return this.scrollToBottom('Input your command and select from tips');\n      }\n\n      // multi-exec mode\n      if (paramsArr[0] == 'multi') {\n        this.multiQueue = [];\n        return this.scrollToBottom('OK');\n      }\n\n      // multi-discard-mode\n      if (paramsArr[0] == 'discard') {\n      // discard when not multi condition\n        if (!Array.isArray(this.multiQueue)) {\n          return this.scrollToBottom('(error) ERR DISCARD without MULTI');\n        }\n        this.multiQueue = null;\n        return this.scrollToBottom('OK');\n      }\n\n      // multi dequeue\n      if (paramsArr[0] == 'exec') {\n        // exec when not multi condition\n        if (!Array.isArray(this.multiQueue)) {\n          return this.scrollToBottom('(error) ERR EXEC without MULTI');\n        }\n\n        this.anoClient.multi(this.multiQueue).execBuffer((err, reply) => {\n          if (err) {\n            this.content.push(`${err}`);\n          } else {\n            this.content.push(this.resolveResult(reply).trim());\n          }","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/qishibo/AnotherRedisDesktopManager/blob/c149855106628babcdfb7675a8e7ba9434d2492a/src/components/CliTab.vue#L204-L240","documentation":"CliTab keeps MULTI/EXEC state locally: typing MULTI sets multiQueue = [], and only while it is an Array are commands queued. DISCARD typed when multiQueue is null makes the CLI echo the exact string real Redis returns - '(error) ERR DISCARD without MULTI' - entirely client-side; no command reaches the server.","triggerScenarios":"Typing DISCARD before any MULTI in the workbench CLI; after a previous EXEC or DISCARD already reset the queue to null; or after an errored command whose .catch set multiQueue = null (CliTab.vue:282).","commonSituations":"Pasting a transaction script twice (the second DISCARD fails), a failed command aborting the local queue, mixed habits between manual MULTI and one-shot commands.","solutions":["Start the transaction with MULTI before using DISCARD","Check earlier terminal output - a previous EXEC/DISCARD or a failed command already closed the transaction","Re-run the intended MULTI block from the beginning"],"exampleFix":"// guard the CLI input before dispatching\nif (paramsArr[0] === 'discard' && !Array.isArray(this.multiQueue)) {\n  return this.scrollToBottom('hint: no MULTI in progress, type MULTI first');\n}","handlingStrategy":"validation","validationCode":"// validate local transaction state before echoing a server-style error\nfunction canDiscard(multiQueue) {\n  return Array.isArray(multiQueue);\n}\n\nif (paramsArr[0] === 'discard' && !canDiscard(this.multiQueue)) {\n  return this.scrollToBottom('no MULTI in progress - type MULTI first');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Track MULTI state explicitly; any failed command resets the queue in this CLI","Paste transaction scripts as whole MULTI..EXEC/DISCARD blocks, not line by line","Remember this error is generated locally - the server never saw your DISCARD"],"tags":["redis","cli","multi-exec","transactions","ardm"],"backgroundTag":"redis-transaction-error","analyzedSha":"c149855106628babcdfb7675a8e7ba9434d2492a","analyzedAt":"2026-08-22T09:06:28.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}