{"record":{"id":"c47a6dc62ffdbb24","repo":"denoland/deno","slug":"err-missing-args-c47a6d","errorCode":"ERR_MISSING_ARGS","errorMessage":"The \"file\" argument must be specified","messagePattern":"The \"file\" argument must be specified","errorType":"validation","errorClass":"ERR_MISSING_ARGS","httpStatus":null,"severity":"info","filePath":"ext/node/polyfills/repl.ts","lineNumber":474,"sourceCode":"          longestNameLength - name.length + 3,\n        );\n        const line = `.${name}${cmd.help ? spaces + cmd.help : \"\"}\\n`;\n        this.output.write(line);\n      });\n      this.output.write(\n        \"\\nPress Ctrl+C to abort current expression, \" +\n          \"Ctrl+D to exit the REPL\\n\",\n      );\n      this.displayPrompt();\n    },\n  });\n\n  repl.defineCommand(\"save\", {\n    help: \"Save all evaluated commands in this REPL session to a file\",\n    action: function (this: REPLServer, file: string) {\n      try {\n        if (file === \"\") {\n          throw new ERR_MISSING_ARGS(\"file\");\n        }\n        fs.writeFileSync(file, ArrayPrototypeJoin(this.lines, \"\\n\"));\n        this.output.write(`Session saved to: ${file}\\n`);\n      } catch (error) {\n        if ((error as { code?: string })?.code === \"ERR_MISSING_ARGS\") {\n          this.output.write(`${(error as Error).message}\\n`);\n        } else {\n          this.output.write(`Failed to save: ${file}\\n`);\n        }\n      }\n      this.displayPrompt();\n    },\n  });\n\n  repl.defineCommand(\"load\", {\n    help: \"Load JS from a file into the REPL session\",\n    action: function (this: REPLServer, file: string) {\n      try {","sourceCodeStart":456,"sourceCodeEnd":492,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/ext/node/polyfills/repl.ts#L456-L492","documentation":"The REPL dot-command `.save` writes every line evaluated in the current session to a file. It requires a filename argument; when invoked with none (`file === ''`) it throws ERR_MISSING_ARGS, which the command's own catch block converts into the printed line 'The \"file\" argument must be specified' before re-displaying the prompt. The error never escapes to the session.","triggerScenarios":"Typing `.save` with no filename (the REPL trims the rest of the line to an empty string) in a `deno` or node:repl session.","commonSituations":"Users expecting `.save` alone to pick a default file (like shell history tools); typos such as `.save>`; scripted/programmatic REPL input that forgets to append the path.","solutions":["Type the command with a path: `.save /tmp/session.js`","Check the syntax — the filename follows the command separated by a space, e.g. `.save session.log`"],"exampleFix":"// before\ndeno> .save\nThe \"file\" argument must be specified\n\n// after\ndeno> .save session.js\nSession saved to: session.js","handlingStrategy":"validation","validationCode":"// programmatic REPL driver: check the filename before sending .save\nconst file = process.argv[2];\nif (!file) {\n  console.error('usage: .save <file>');\n} else {\n  replServer.write(`.save ${file}\\n`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always append a filename after .save","Use absolute paths so the session file lands where you expect"],"tags":["repl","cli","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}