wavetermdev/waveterm · error

no blockid in request

Error message

no blockid in request

What it means

resolveThis resolves the 'this'/'block' simple id to an ORef pointing at the current block, which requires the request to carry data.BlockId. This error is thrown when the request's BlockId is empty — there is no block context to resolve against. It is a request-shape error from the resolver layer.

Source

Thrown at pkg/wshrpc/wshserver/resolvers.go:84

	if _, err := strconv.Atoi(simpleId); err == nil {
		return "blocknum", simpleId, nil
	}

	// Check for UUIDs
	if _, err := uuid.Parse(simpleId); err == nil {
		return "uuid", simpleId, nil
	}
	if shortUUIDRe.MatchString(strings.ToLower(simpleId)) {
		return "uuid8", simpleId, nil
	}

	return "", "", fmt.Errorf("invalid simple id format: %s", simpleId)
}

// Individual resolvers
func resolveThis(ctx context.Context, data wshrpc.CommandResolveIdsData, value string) (*waveobj.ORef, error) {
	if data.BlockId == "" {
		return nil, fmt.Errorf("no blockid in request")
	}

	if value == SimpleId_This || value == SimpleId_Block {
		return &waveobj.ORef{OType: waveobj.OType_Block, OID: data.BlockId}, nil
	}
	if value == SimpleId_Tab {
		tabId, err := wstore.DBFindTabForBlockId(ctx, data.BlockId)
		if err != nil {
			return nil, fmt.Errorf("error finding tab: %v", err)
		}
		return &waveobj.ORef{OType: waveobj.OType_Tab, OID: tabId}, nil
	}
	if value == SimpleId_Ws || value == SimpleId_Workspace {
		tabId, err := wstore.DBFindTabForBlockId(ctx, data.BlockId)
		if err != nil {
			return nil, fmt.Errorf("error finding tab: %v", err)
		}
		wsId, err := wstore.DBFindWorkspaceForTabId(ctx, tabId)

View on GitHub (pinned to a4447c1563)

Solutions

  1. Populate data.BlockId in CommandResolveIdsData before calling ResolveIds.
  2. Use a workspace/tab keyword instead of 'this' when no block context exists.
  3. Ensure the calling component passes its owning block id through the RPC options/data.

Example fix

// before
wshclient.ResolveIdsCommand(ctx, wshrpc.CommandResolveIdsData{SimpleId: "this"}, nil)
// after
wshclient.ResolveIdsCommand(ctx, wshrpc.CommandResolveIdsData{SimpleId: "this", BlockId: blockId}, nil)
Defensive patterns

Strategy: validation

Validate before calling

if data.BlockId == "" {
    return errors.New("ResolveIds with 'this'/'block' requires BlockId")
}
_ = wshclient.ResolveIdsCommand(ctx, wshrpc.CommandResolveIdsData{SimpleId: "this", BlockId: data.BlockId}, nil)

Type guard

func hasBlockContext(d wshrpc.CommandResolveIdsData) bool {
    return d.BlockId != ""
}

Try / catch

rtn, err := wshclient.ResolveIdsCommand(ctx, reqData, nil)
if err != nil {
    if strings.Contains(err.Error(), "no blockid in request") {
        // caller had no block scope; re-issue with an explicit blockId or use 'ws'
    }
    return err
}

Prevention

When it happens

Trigger: Calling the ResolveIds command with simpleId 'this' or 'block' from a context where CommandResolveIdsData.BlockId was not populated — e.g. a global (non-block-scoped) RPC invocation.

Common situations: Calling resolveIds from a window-level or tab-level context rather than inside a block; frontend forgetting to pass the blockId in the request data; wsh CLI used outside a block context.

Related errors


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