wavetermdev/waveterm · error
too many arguments. wsh editor requires exactly one argumen
Error message
too many arguments. wsh editor requires exactly one argument
What it means
Returned by wsh editor when more than one argument is given; the command accepts exactly one file or URL.
Source
Thrown at cmd/wsh/cmd/wshcmd-editor.go:43
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)
}
tabId := getTabIdFromEnv()
if tabId == "" {
return fmt.Errorf("no WAVETERM_TABID env var set")
}View on GitHub (pinned to a4447c1563)
Solutions
- Pass only one file or URL argument
- Quote paths containing spaces: `wsh editor "my file.txt"`
- Open additional files with separate invocations
Example fix
// before wsh editor my file.txt // after wsh editor "my file.txt"
Defensive patterns
Strategy: validation
Validate before calling
if len(args) > 1 {
return errors.New("wsh editor accepts exactly one argument; quote paths with spaces")
} Prevention
- Quote any path containing spaces
- Open multiple files with separate wsh editor calls
- Inspect how your script expands variables before passing to wsh
When it happens
Trigger: Running `wsh editor file1 file2` or passing extra flags/words that cobra does not consume as flags.
Common situations: Trying to open multiple files at once (not supported); an unquoted path containing spaces being split into two args.
Related errors
- invalid mode %q (expected %q or %q)
- no arguments. wsh editor requires a file or URL as an argum
- 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/eb0d5f29c8cb930e.
Report an issue: GitHub.