wavetermdev/waveterm · error

creating block: %w

Error message

creating block: %w

What it means

After building the CommandCreateBlockData, webOpenRun calls CreateBlockCommand over wsh RPC to create (or replace into) the web block. Any RPC failure — unreachable server, invalid tab id, invalid target block — is wrapped with "creating block:".

Source

Thrown at cmd/wsh/cmd/wshcmd-web.go:137

	wshCmd := wshrpc.CommandCreateBlockData{
		TabId: tabId,
		BlockDef: &waveobj.BlockDef{
			Meta: map[string]any{
				waveobj.MetaKey_View: "web",
				waveobj.MetaKey_Url:  args[0],
			},
		},
		Magnified: webOpenMagnified,
		Focused:   true,
	}
	if replaceBlockORef != nil {
		wshCmd.TargetBlockId = replaceBlockORef.OID
		wshCmd.TargetAction = wshrpc.CreateBlockAction_Replace
	}
	oref, err := wshclient.CreateBlockCommand(RpcClient, wshCmd, nil)
	if err != nil {
		return fmt.Errorf("creating block: %w", err)
	}
	WriteStdout("created block %s\n", oref)
	return nil
}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Re-run the command from a live Wave tab (refresh WAVETERM_TABID)
  2. Verify the --replace target block is still open
  3. Check wsh connectivity (wsh ls succeeds) before retrying
Defensive patterns

Strategy: retry

Validate before calling

// ensure connectivity and target validity first
if _, err := wshclient.BlockInfoCommand(RpcClient, replaceOID, nil); err != nil {
    return fmt.Errorf("replace target unavailable: %w", err)
}

Try / catch

oref, err := wshclient.CreateBlockCommand(RpcClient, wshCmd, nil)
if err != nil {
    return fmt.Errorf("creating block: %w", err)
}

Prevention

When it happens

Trigger: `wsh web open <url>` where the Wave server rejects CreateBlockCommand: tab no longer exists, replace target block was closed, or the RPC connection dropped.

Common situations: Race where the tab or target block closed between resolution and creation; running from a stale wsh session; server-side validation rejecting the BlockDef meta.

Related errors


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