{"record":{"id":"836e800850159f52","repo":"wavetermdev/waveterm","slug":"no-arguments-wsh-editor-requires-a-file-or-url-a","errorCode":null,"errorMessage":"no arguments.  wsh editor requires a file or URL as an argument argument","messagePattern":"no arguments\\.  wsh editor requires a file or URL as an argument argument","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-editor.go","lineNumber":39,"sourceCode":"var editorCmd = &cobra.Command{\n\tUse:     \"editor\",\n\tShort:   \"edit a file (blocks until editor is closed)\",\n\tRunE:    editorRun,\n\tPreRunE: preRunSetupRpcClient,\n}\n\nfunc init() {\n\teditorCmd.Flags().BoolVarP(&editMagnified, \"magnified\", \"m\", false, \"open view in magnified mode\")\n\trootCmd.AddCommand(editorCmd)\n}\n\nfunc editorRun(cmd *cobra.Command, args []string) (rtnErr error) {\n\tdefer func() {\n\t\tsendActivity(\"editor\", rtnErr == nil)\n\t}()\n\tif len(args) == 0 {\n\t\tOutputHelpMessage(cmd)\n\t\treturn fmt.Errorf(\"no arguments.  wsh editor requires a file or URL as an argument argument\")\n\t}\n\tif len(args) > 1 {\n\t\tOutputHelpMessage(cmd)\n\t\treturn fmt.Errorf(\"too many arguments.  wsh editor requires exactly one argument\")\n\t}\n\tfileArg := args[0]\n\tabsFile, err := filepath.Abs(fileArg)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting absolute path: %w\", err)\n\t}\n\t_, err = os.Stat(absFile)\n\tif err == fs.ErrNotExist {\n\t\treturn fmt.Errorf(\"file does not exist: %q\", absFile)\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting file info: %w\", err)\n\t}\n","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-editor.go#L21-L57","documentation":"Returned by wsh editor when no file or URL argument is supplied; the command requires exactly one target.","triggerScenarios":"Running bare `wsh editor` with no file or URL argument.","commonSituations":"Typing `wsh editor` expecting it to open a picker; a script variable holding the filename was empty.","solutions":["Pass the file to edit: `wsh editor <file-or-url>`","Check that your script's file path variable is not empty","Run `wsh editor --help` for usage"],"exampleFix":"// before\nwsh editor\n// after\nwsh editor ~/config/settings.json","handlingStrategy":"validation","validationCode":"args := os.Args[2:] // after subcommand parsing\nif len(args) == 0 {\n    return errors.New(\"wsh editor needs one file or URL argument\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass a file/URL to `wsh editor`","Guard scripts: `[ -n \"$file\" ] || exit 1` before invoking","Read `wsh editor --help` for accepted arguments"],"tags":["cli","argument-error","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}