wavetermdev/waveterm · error
no connection specified
Error message
no connection specified
What it means
Returned by connReinstallRun (the `wsh conn reinstall` command) when no connection name argument is given and no default connection is set in RpcContext.Conn. The command needs exactly one connection name to target the reinstall operation.
Source
Thrown at cmd/wsh/cmd/wshcmd-conn.go:128
WriteStdout("no connections\n")
return nil
}
WriteStdout("%-30s %-12s\n", "connection", "status")
WriteStdout("----------------------------------------------\n")
for _, conn := range allResp {
str := fmt.Sprintf("%-30s %-12s", conn.Connection, conn.Status)
if conn.Error != "" {
str += fmt.Sprintf(" (%s)", conn.Error)
}
WriteStdout("%s\n", str)
}
return nil
}
func connReinstallRun(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
if RpcContext.Conn == "" {
return fmt.Errorf("no connection specified")
}
args = []string{RpcContext.Conn}
}
connName := args[0]
if err := validateConnectionName(connName); err != nil {
return err
}
data := wshrpc.ConnExtData{
ConnName: connName,
LogBlockId: RpcContext.BlockId,
}
err := wshclient.ConnReinstallWshCommand(RpcClient, data, &wshrpc.RpcOpts{Timeout: 60000})
if err != nil {
return fmt.Errorf("reinstalling connection: %w", err)
}
WriteStdout("wsh reinstalled on connection %q\n", connName)
return nil
}View on GitHub (pinned to a4447c1563)
Solutions
- Pass the connection name as an argument: `wsh conn reinstall <connname>`
- Set the connection via the --conn flag so RpcContext.Conn is populated
- List available connections with `wsh conn status` to pick the right name
Example fix
// before wsh conn reinstall // error: no connection specified // after wsh conn reinstall myserver
Defensive patterns
Strategy: validation
Validate before calling
connName := args[0]
if len(args) < 1 {
if RpcContext.Conn == "" {
return fmt.Errorf("usage: wsh conn reinstall <connname> (or set --conn)")
}
connName = RpcContext.Conn
}
if err := validateConnectionName(connName); err != nil {
return err
} Prevention
- Always pass the connection name explicitly in scripts
- Set the --conn flag when relying on ambient context
- Run `wsh conn status` first to confirm target names
- Add shell completion/usage text so the requirement is obvious
When it happens
Trigger: Running `wsh conn reinstall` with zero arguments while RpcContext.Conn is empty (no --conn flag and no ambient connection context).
Common situations: Forgetting the connection argument in scripts, omitting the --conn flag when invoking wsh remotely, or relying on an ambient connection that was never set.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- stdin (-) can only be used once
- watching pid: %v
- cannot parse connection name: %w
- connecting connection: %w
- wsh token requires exactly 2 arguments, got %d
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/8358c552c6df1dcb.
Report an issue: GitHub.