wavetermdev/waveterm · error

too many arguments. wsh wavepath requires exactly one argume

Error message

too many arguments. wsh wavepath requires exactly one argument

What it means

Returned by wsh wavepath when more than one argument is given; the command accepts exactly one path argument.

Source

Thrown at cmd/wsh/cmd/wshcmd-wavepath.go:42

func init() {
	wavepathCmd.Flags().BoolP("open", "o", false, "Open the path in a new block")
	wavepathCmd.Flags().BoolP("open-external", "O", false, "Open the path in the default external application")
	wavepathCmd.Flags().BoolP("tail", "t", false, "Tail the last 100 lines of the log")
	rootCmd.AddCommand(wavepathCmd)
}

func wavepathRun(cmd *cobra.Command, args []string) (rtnErr error) {
	defer func() {
		sendActivity("wavepath", rtnErr == nil)
	}()

	if len(args) == 0 {
		OutputHelpMessage(cmd)
		return fmt.Errorf("no arguments. wsh wavepath requires a type argument (config, data, or log)")
	}
	if len(args) > 1 {
		OutputHelpMessage(cmd)
		return fmt.Errorf("too many arguments. wsh wavepath requires exactly one argument")
	}

	pathType := args[0]
	if pathType != "config" && pathType != "data" && pathType != "log" {
		OutputHelpMessage(cmd)
		return fmt.Errorf("invalid path type %q. must be one of: config, data, log", pathType)
	}

	tail, _ := cmd.Flags().GetBool("tail")
	if tail && pathType != "log" {
		return fmt.Errorf("--tail can only be used with the log path type")
	}

	open, _ := cmd.Flags().GetBool("open")
	openExternal, _ := cmd.Flags().GetBool("open-external")

	tabId := getTabIdFromEnv()
	if tabId == "" {

View on GitHub (pinned to a4447c1563)

Solutions

  1. Pass exactly one type: `wsh wavepath config`
  2. Query other types with separate calls: `wsh wavepath data; wsh wavepath log`
  3. Quote variables so they expand to a single word: `wsh wavepath "$TYPE"`

Example fix

// before
$ wsh wavepath config data
// error: too many arguments

// after
$ wsh wavepath config && wsh wavepath data
Defensive patterns

Strategy: validation

Validate before calling

case "$TYPE" in
  config|data|log) wsh wavepath "$TYPE" ;;
  *) echo "invalid type: $TYPE" >&2; exit 2 ;;
esac

Prevention

When it happens

Trigger: Running `wsh wavepath config data`, extra positional args from unquoted variables, or passing flags that get treated as positionals.

Common situations: Users guessing it takes multiple types at once; shell word-splitting on `wsh wavepath "$TYPES"` where TYPES contains spaces; typos mistaken for extra args.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/dc9217485cea6545. Report an issue: GitHub.