wavetermdev/waveterm · error
no arguments. wsh editor requires a file or URL as an argum
Error message
no arguments. wsh editor requires a file or URL as an argument argument
What it means
Returned by wsh editor when no file or URL argument is supplied; the command requires exactly one target.
Source
Thrown at cmd/wsh/cmd/wshcmd-editor.go:39
var editorCmd = &cobra.Command{
Use: "editor",
Short: "edit a file (blocks until editor is closed)",
RunE: editorRun,
PreRunE: preRunSetupRpcClient,
}
func init() {
editorCmd.Flags().BoolVarP(&editMagnified, "magnified", "m", false, "open view in magnified mode")
rootCmd.AddCommand(editorCmd)
}
func editorRun(cmd *cobra.Command, args []string) (rtnErr error) {
defer func() {
sendActivity("editor", rtnErr == nil)
}()
if len(args) == 0 {
OutputHelpMessage(cmd)
return fmt.Errorf("no arguments. wsh editor requires a file or URL as an argument argument")
}
if len(args) > 1 {
OutputHelpMessage(cmd)
return fmt.Errorf("too many arguments. wsh editor requires exactly one argument")
}
fileArg := args[0]
absFile, err := filepath.Abs(fileArg)
if err != nil {
return fmt.Errorf("getting absolute path: %w", err)
}
_, err = os.Stat(absFile)
if err == fs.ErrNotExist {
return fmt.Errorf("file does not exist: %q", absFile)
}
if err != nil {
return fmt.Errorf("getting file info: %w", err)
}
View on GitHub (pinned to a4447c1563)
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
Example fix
// before wsh editor // after wsh editor ~/config/settings.json
Defensive patterns
Strategy: validation
Validate before calling
args := os.Args[2:] // after subcommand parsing
if len(args) == 0 {
return errors.New("wsh editor needs one file or URL argument")
} Prevention
- Always pass a file/URL to `wsh editor`
- Guard scripts: `[ -n "$file" ] || exit 1` before invoking
- Read `wsh editor --help` for accepted arguments
When it happens
Trigger: Running bare `wsh editor` with no file or URL argument.
Common situations: Typing `wsh editor` expecting it to open a picker; a script variable holding the filename was empty.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- invalid mode %q (expected %q or %q)
- too many arguments. wsh editor requires exactly one argumen
- badge oref must be a block or tab (got %q)
- unknown --view %q; try one of: term, web, preview, edit, sys
- --workspace and --window are mutually exclusive; specify onl
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/836e800850159f52.
Report an issue: GitHub.