{"record":{"id":"dc9217485cea6545","repo":"wavetermdev/waveterm","slug":"too-many-arguments-wsh-wavepath-requires-exactly","errorCode":null,"errorMessage":"too many arguments. wsh wavepath requires exactly one argument","messagePattern":"too many arguments\\. wsh wavepath requires exactly one argument","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-wavepath.go","lineNumber":42,"sourceCode":"func init() {\n\twavepathCmd.Flags().BoolP(\"open\", \"o\", false, \"Open the path in a new block\")\n\twavepathCmd.Flags().BoolP(\"open-external\", \"O\", false, \"Open the path in the default external application\")\n\twavepathCmd.Flags().BoolP(\"tail\", \"t\", false, \"Tail the last 100 lines of the log\")\n\trootCmd.AddCommand(wavepathCmd)\n}\n\nfunc wavepathRun(cmd *cobra.Command, args []string) (rtnErr error) {\n\tdefer func() {\n\t\tsendActivity(\"wavepath\", rtnErr == nil)\n\t}()\n\n\tif len(args) == 0 {\n\t\tOutputHelpMessage(cmd)\n\t\treturn fmt.Errorf(\"no arguments. wsh wavepath requires a type argument (config, data, or log)\")\n\t}\n\tif len(args) > 1 {\n\t\tOutputHelpMessage(cmd)\n\t\treturn fmt.Errorf(\"too many arguments. wsh wavepath requires exactly one argument\")\n\t}\n\n\tpathType := args[0]\n\tif pathType != \"config\" && pathType != \"data\" && pathType != \"log\" {\n\t\tOutputHelpMessage(cmd)\n\t\treturn fmt.Errorf(\"invalid path type %q. must be one of: config, data, log\", pathType)\n\t}\n\n\ttail, _ := cmd.Flags().GetBool(\"tail\")\n\tif tail && pathType != \"log\" {\n\t\treturn fmt.Errorf(\"--tail can only be used with the log path type\")\n\t}\n\n\topen, _ := cmd.Flags().GetBool(\"open\")\n\topenExternal, _ := cmd.Flags().GetBool(\"open-external\")\n\n\ttabId := getTabIdFromEnv()\n\tif tabId == \"\" {","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-wavepath.go#L24-L60","documentation":"Returned by wsh wavepath when more than one argument is given; the command accepts exactly one path argument.","triggerScenarios":"Running `wsh wavepath config data`, extra positional args from unquoted variables, or passing flags that get treated as positionals.","commonSituations":"Users guessing it takes multiple types at once; shell word-splitting on `wsh wavepath \"$TYPES\"` where TYPES contains spaces; typos mistaken for extra args.","solutions":["Pass exactly one type: `wsh wavepath config`","Query other types with separate calls: `wsh wavepath data; wsh wavepath log`","Quote variables so they expand to a single word: `wsh wavepath \"$TYPE\"`"],"exampleFix":"// before\n$ wsh wavepath config data\n// error: too many arguments\n\n// after\n$ wsh wavepath config && wsh wavepath data","handlingStrategy":"validation","validationCode":"case \"$TYPE\" in\n  config|data|log) wsh wavepath \"$TYPE\" ;;\n  *) echo \"invalid type: $TYPE\" >&2; exit 2 ;;\nesac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass exactly one whitelisted type argument","Quote expansions to prevent word-splitting into extra args"],"tags":["cli","argument-validation","wsh"],"backgroundTag":"too-many-cli-arguments","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}