{"record":{"id":"eb0d5f29c8cb930e","repo":"wavetermdev/waveterm","slug":"too-many-arguments-wsh-editor-requires-exactly-o","errorCode":null,"errorMessage":"too many arguments.  wsh editor requires exactly one argument","messagePattern":"too many arguments\\.  wsh editor requires exactly one argument","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-editor.go","lineNumber":43,"sourceCode":"\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\n\ttabId := getTabIdFromEnv()\n\tif tabId == \"\" {\n\t\treturn fmt.Errorf(\"no WAVETERM_TABID env var set\")\n\t}","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-editor.go#L25-L61","documentation":"Returned by wsh editor when more than one argument is given; the command accepts exactly one file or URL.","triggerScenarios":"Running `wsh editor file1 file2` or passing extra flags/words that cobra does not consume as flags.","commonSituations":"Trying to open multiple files at once (not supported); an unquoted path containing spaces being split into two args.","solutions":["Pass only one file or URL argument","Quote paths containing spaces: `wsh editor \"my file.txt\"`","Open additional files with separate invocations"],"exampleFix":"// before\nwsh editor my file.txt\n// after\nwsh editor \"my file.txt\"","handlingStrategy":"validation","validationCode":"if len(args) > 1 {\n    return errors.New(\"wsh editor accepts exactly one argument; quote paths with spaces\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Quote any path containing spaces","Open multiple files with separate wsh editor calls","Inspect how your script expands variables before passing to wsh"],"tags":["cli","argument-error","validation"],"backgroundTag":"too-many-arguments","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}