wavetermdev/waveterm · error
no arguments. wsh %s requires a file or URL as an argument
Error message
no arguments. wsh %s requires a file or URL as an argument argument
What it means
The `wsh view` (or `wsh edit`/`wsh open`) command in Wave Terminal creates a new preview block from a file path or URL. The viewRun handler validates its positional args before doing any work; if the user runs the command with zero arguments it prints the command help and returns this error instead of silently doing nothing. The awkward trailing 'argument argument' is just a formatting quirk in the message template.
Source
Thrown at cmd/wsh/cmd/wshcmd-view.go:50
RunE: viewRun,
PreRunE: preRunSetupRpcClient,
}
func init() {
viewCmd.Flags().BoolVarP(&viewMagnified, "magnified", "m", false, "open view in magnified mode")
rootCmd.AddCommand(viewCmd)
editCmd.Flags().BoolVarP(&viewMagnified, "magnified", "m", false, "open view in magnified mode")
rootCmd.AddCommand(editCmd)
}
func viewRun(cmd *cobra.Command, args []string) (rtnErr error) {
cmdName := cmd.Name()
defer func() {
sendActivity(cmdName, rtnErr == nil)
}()
if len(args) == 0 {
OutputHelpMessage(cmd)
return fmt.Errorf("no arguments. wsh %s requires a file or URL as an argument argument", cmdName)
}
if len(args) > 1 {
OutputHelpMessage(cmd)
return fmt.Errorf("too many arguments. wsh %s requires exactly one argument", cmdName)
}
tabId := getTabIdFromEnv()
if tabId == "" {
return fmt.Errorf("no WAVETERM_TABID env var set")
}
fileArg := args[0]
conn := RpcContext.Conn
var wshCmd *wshrpc.CommandCreateBlockData
if strings.HasPrefix(fileArg, "http://") || strings.HasPrefix(fileArg, "https://") {
wshCmd = &wshrpc.CommandCreateBlockData{
TabId: tabId,
BlockDef: &waveobj.BlockDef{
Meta: map[string]any{
waveobj.MetaKey_View: "web",View on GitHub (pinned to a4447c1563)
Solutions
- Pass exactly one file path or http(s) URL, e.g. `wsh view ./notes.md` or `wsh view https://example.com`
- If the arg comes from a shell variable, check it is non-empty before invoking: `[ -n "$FILE" ] && wsh view "$FILE"`
- Run `wsh view --help` / `wsh help view` to see the expected usage
Example fix
// before $ wsh view // error: no arguments... // after $ wsh view ~/notes.md
Defensive patterns
Strategy: validation
Validate before calling
if [ -z "$TARGET" ]; then echo "usage: wsh view <file-or-url>" >&2; exit 2; fi wsh view "$TARGET"
Prevention
- Always pass one quoted operand to wsh view
- Guard empty shell variables before invoking
- Keep paths quoted to avoid word-splitting surprises
When it happens
Trigger: Running `wsh view` (or edit/open variants routed through viewRun) with no positional argument at all, e.g. `wsh view` or `wsh edit` on the CLI.
Common situations: Users forget the file/URL operand; shell scripts or aliases call the command with an empty variable (`wsh view $FILE` where FILE is unset); documentation examples omit the argument.
Related errors
- stdin (-) can only be used once
- too many arguments. wsh %s requires exactly one argument
- no arguments. wsh wavepath requires a type argument (config,
- too many arguments. wsh wavepath requires exactly one argume
- invalid path type %q. must be one of: config, data, log
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/903d516d37b666f3.
Report an issue: GitHub.