wavetermdev/waveterm · error
setting connection in block: %w
Error message
setting connection in block: %w
What it means
wslRun calls SetMetaCommand to persist the distro name as the block's connection meta. If the RPC fails (block gone, disconnected client, server error), the cause is wrapped with "setting connection in block:".
Source
Thrown at cmd/wsh/cmd/wshcmd-wsl.go:59
return err
}
}
if !strings.HasPrefix(distroName, "wsl://") {
distroName = "wsl://" + distroName
}
blockId := RpcContext.BlockId
if blockId == "" {
return fmt.Errorf("cannot determine blockid (not in JWT)")
}
data := wshrpc.CommandSetMetaData{
ORef: waveobj.MakeORef(waveobj.OType_Block, blockId),
Meta: map[string]any{
waveobj.MetaKey_Connection: distroName,
},
}
err = wshclient.SetMetaCommand(RpcClient, data, nil)
if err != nil {
return fmt.Errorf("setting connection in block: %w", err)
}
WriteStderr("switched connection to %q\n", distroName)
return nil
}
View on GitHub (pinned to a4447c1563)
Solutions
- Confirm the distro name (e.g. "Ubuntu-22.04") and retry
- Ensure the originating Wave block is still open and Wave is running
- Re-run from a fresh Wave terminal to get a fresh JWT/context
Defensive patterns
Strategy: retry
Try / catch
err = wshclient.SetMetaCommand(RpcClient, data, nil)
if err != nil {
return fmt.Errorf("setting connection in block: %w", err)
} Prevention
- Verify the distro name exists (wsl -l) before setting
- Retry once on transient RPC errors
- Ensure the block is open for the duration of the command
When it happens
Trigger: `wsh wsl set <distro>` where the block identified by the JWT was closed before the call, the WSL connection name is invalid, or the wsh RPC connection to the Wave server failed.
Common situations: Typos in the distro name; block closed while command ran; running from a stale shell after Wave restarted.
Related errors
- getting wsl connection status: %w
- playing system bell: %v
- watching pid: %v
- reinstalling connection: %w
- disconnecting %q error: %w
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/c4a6e36109d39110.
Report an issue: GitHub.