wavetermdev/waveterm · error

resolving blockid: %w

Error message

resolving blockid: %w

What it means

`wsh web get` needs to resolve its block argument to a full ORef (object reference). resolveBlockArg failed, meaning the blockid/circuit arg could not be turned into a valid block reference before any RPC. This is a client-side resolution failure.

Source

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

var webGetJson bool
var webOpenMagnified bool
var webOpenReplaceBlock string

func init() {
	webOpenCmd.Flags().BoolVarP(&webOpenMagnified, "magnified", "m", false, "open view in magnified mode")
	webOpenCmd.Flags().StringVarP(&webOpenReplaceBlock, "replace", "r", "", "replace block")
	webCmd.AddCommand(webOpenCmd)
	webGetCmd.Flags().BoolVarP(&webGetInner, "inner", "", false, "get inner html (instead of outer)")
	webGetCmd.Flags().BoolVarP(&webGetAll, "all", "", false, "get all matches (querySelectorAll)")
	webGetCmd.Flags().BoolVarP(&webGetJson, "json", "", false, "output as json")
	webCmd.AddCommand(webGetCmd)
	rootCmd.AddCommand(webCmd)
}

func webGetRun(cmd *cobra.Command, args []string) error {
	fullORef, err := resolveBlockArg()
	if err != nil {
		return fmt.Errorf("resolving blockid: %w", err)
	}
	blockInfo, err := wshclient.BlockInfoCommand(RpcClient, fullORef.OID, nil)
	if err != nil {
		return fmt.Errorf("getting block info: %w", err)
	}
	if blockInfo.Block.Meta.GetString(waveobj.MetaKey_View, "") != "web" {
		return fmt.Errorf("block %s is not a web block", fullORef.OID)
	}
	data := wshrpc.CommandWebSelectorData{
		WorkspaceId: blockInfo.WorkspaceId,
		BlockId:     fullORef.OID,
		TabId:       blockInfo.TabId,
		Selector:    args[0],
		Opts: &wshrpc.WebSelectorOpts{
			Inner: webGetInner,
			All:   webGetAll,
		},
	}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Pass an explicit valid block id: `wsh web get <blockid>` from inside the target block.
  2. Run the command from inside a Wave block so the block id env is set.
  3. Verify the block still exists/is open in the terminal.
  4. Check `wsh ls` output for the correct block id syntax.

Example fix

// before
wsh web get  # relies on ambient block context
// after
wsh web get B<oid>  # or run inside the web block
Defensive patterns

Strategy: validation

Validate before calling

if os.Getenv("WAVETERM_BLOCKID") == "" && len(args) < 1 { fatal("no block id supplied") }

Type guard

func looksLikeOID(s string) bool { return len(s) >= 8 && !strings.ContainsAny(s, " /\\t") }

Try / catch

fullORef, err := resolveBlockArg()
if err != nil { fmt.Fprintf(os.Stderr, "pass an explicit blockid: %v\n", err); os.Exit(2) }

Prevention

When it happens

Trigger: Running `wsh web get <arg>` with a missing, malformed, or unresolvable block id (e.g. no blockid in env, invalid OID syntax, or the circuit syntax failing to resolve to a block).

Common situations: Running wsh web get outside a block context (no WAVETERM_BLOCKID), pasting a partial/truncated block id, or referencing a block that has been closed.

Related errors


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