{"record":{"id":"ba37e9048f45d8de","repo":"wavetermdev/waveterm","slug":"failed-to-list-blocks-from-all-d-workspace-s","errorCode":null,"errorMessage":"failed to list blocks from all %d workspace(s)","messagePattern":"failed to list blocks from all (.+?) workspace\\(s\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-blocks.go","lineNumber":190,"sourceCode":"\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tv := b.Meta.GetString(waveobj.MetaKey_View, \"\")\n\t\t\tallBlocks = append(allBlocks, BlockDetails{\n\t\t\t\tBlockId:     b.BlockId,\n\t\t\t\tWorkspaceId: b.WorkspaceId,\n\t\t\t\tTabId:       b.TabId,\n\t\t\t\tView:        v,\n\t\t\t\tMeta:        b.Meta,\n\t\t\t})\n\t\t}\n\t}\n\n\t// No blocks found check\n\tif len(allBlocks) == 0 {\n\t\tif !hadSuccess {\n\t\t\treturn fmt.Errorf(\"failed to list blocks from all %d workspace(s)\", len(workspaceIdsToQuery))\n\t\t}\n\t\tWriteStdout(\"No blocks found\\n\")\n\t\treturn nil\n\t}\n\n\t// Stable ordering for both JSON and table output\n\tsort.SliceStable(allBlocks, func(i, j int) bool {\n\t\tif allBlocks[i].WorkspaceId != allBlocks[j].WorkspaceId {\n\t\t\treturn allBlocks[i].WorkspaceId < allBlocks[j].WorkspaceId\n\t\t}\n\t\tif allBlocks[i].TabId != allBlocks[j].TabId {\n\t\t\treturn allBlocks[i].TabId < allBlocks[j].TabId\n\t\t}\n\t\treturn allBlocks[i].BlockId < allBlocks[j].BlockId\n\t})\n\n\t// Output results\n\tif blocksJSON {","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-blocks.go#L172-L208","documentation":"Aggregated failure from `wsh blocks list` when zero blocks were collected AND at least one queried workspace errored (hadSuccess is false). Because no workspace answered and no blocks exist, the command distinguishes 'no blocks' from 'every query failed' and reports the latter with the number of workspaces attempted.","triggerScenarios":"All per-workspace get-blocks RPCs fail (connection down, timeouts, unsupported RPC) so allBlocks stays empty and hadSuccess never becomes true; called with N workspace ids in workspaceIdsToQuery.","commonSituations":"Network outage while listing a remote connection's blocks; --timeout too small so every workspace query times out; all targeted workspace ids stale/closed.","solutions":["Check connection health (`wsh conn status`) and retry","Increase --timeout to allow workspace block queries to complete","Drop --workspace/--window filters to query all workspaces fresh","Upgrade the remote wsh/Wave if the get-blocks RPC is unsupported"],"exampleFix":"// before\nwsh blocks list --timeout 2\n// after\nwsh blocks list --timeout 30","handlingStrategy":"retry","validationCode":"// preflight: at least one reachable workspace\nif _, err := wshclient.WorkspaceListCommand(RpcClient, &wshrpc.RpcOpts{Timeout: 10000}); err != nil {\n    return fmt.Errorf(\"no workspaces reachable, aborting block listing: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"blocks, err := listAllBlocks()\nif err != nil {\n    // increase timeout / reconnect, then retry once\n    blocks, err = listAllBlocksWithTimeout(30 * time.Second)\n}","preventionTips":["Use a generous --timeout, especially over SSH/WSL","Confirm connection health before bulk per-workspace queries","Distinguish 'no blocks' from total query failure by logging per-workspace errors"],"tags":["rpc","wsh","timeout","network"],"backgroundTag":"rpc-call-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}