{"record":{"id":"fd4b92f5aaac00bd","repo":"wavetermdev/waveterm","slug":"no-blockid-in-request","errorCode":null,"errorMessage":"no blockid in request","messagePattern":"no blockid in request","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/wshrpc/wshserver/resolvers.go","lineNumber":84,"sourceCode":"\tif _, err := strconv.Atoi(simpleId); err == nil {\n\t\treturn \"blocknum\", simpleId, nil\n\t}\n\n\t// Check for UUIDs\n\tif _, err := uuid.Parse(simpleId); err == nil {\n\t\treturn \"uuid\", simpleId, nil\n\t}\n\tif shortUUIDRe.MatchString(strings.ToLower(simpleId)) {\n\t\treturn \"uuid8\", simpleId, nil\n\t}\n\n\treturn \"\", \"\", fmt.Errorf(\"invalid simple id format: %s\", simpleId)\n}\n\n// Individual resolvers\nfunc resolveThis(ctx context.Context, data wshrpc.CommandResolveIdsData, value string) (*waveobj.ORef, error) {\n\tif data.BlockId == \"\" {\n\t\treturn nil, fmt.Errorf(\"no blockid in request\")\n\t}\n\n\tif value == SimpleId_This || value == SimpleId_Block {\n\t\treturn &waveobj.ORef{OType: waveobj.OType_Block, OID: data.BlockId}, nil\n\t}\n\tif value == SimpleId_Tab {\n\t\ttabId, err := wstore.DBFindTabForBlockId(ctx, data.BlockId)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error finding tab: %v\", err)\n\t\t}\n\t\treturn &waveobj.ORef{OType: waveobj.OType_Tab, OID: tabId}, nil\n\t}\n\tif value == SimpleId_Ws || value == SimpleId_Workspace {\n\t\ttabId, err := wstore.DBFindTabForBlockId(ctx, data.BlockId)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error finding tab: %v\", err)\n\t\t}\n\t\twsId, err := wstore.DBFindWorkspaceForTabId(ctx, tabId)","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/wshrpc/wshserver/resolvers.go#L66-L102","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Populate data.BlockId in CommandResolveIdsData before calling ResolveIds.","Use a workspace/tab keyword instead of 'this' when no block context exists.","Ensure the calling component passes its owning block id through the RPC options/data."],"exampleFix":"// before\nwshclient.ResolveIdsCommand(ctx, wshrpc.CommandResolveIdsData{SimpleId: \"this\"}, nil)\n// after\nwshclient.ResolveIdsCommand(ctx, wshrpc.CommandResolveIdsData{SimpleId: \"this\", BlockId: blockId}, nil)","handlingStrategy":"validation","validationCode":"if data.BlockId == \"\" {\n    return errors.New(\"ResolveIds with 'this'/'block' requires BlockId\")\n}\n_ = wshclient.ResolveIdsCommand(ctx, wshrpc.CommandResolveIdsData{SimpleId: \"this\", BlockId: data.BlockId}, nil)","typeGuard":"func hasBlockContext(d wshrpc.CommandResolveIdsData) bool {\n    return d.BlockId != \"\"\n}","tryCatchPattern":"rtn, err := wshclient.ResolveIdsCommand(ctx, reqData, nil)\nif err != nil {\n    if strings.Contains(err.Error(), \"no blockid in request\") {\n        // caller had no block scope; re-issue with an explicit blockId or use 'ws'\n    }\n    return err\n}","preventionTips":["Always populate BlockId in CommandResolveIdsData when resolving block-relative ids","Use 'ws'/'workspace' keywords when resolving outside a block","Ensure UI components thread their owning block id into RPC data","Decide upfront whether the call site has block context"],"tags":["validation","rpc","resolver"],"backgroundTag":"missing-block-context","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}