{"record":{"id":"92638d75e9742ac8","repo":"wavetermdev/waveterm","slug":"running-view-command-w","errorCode":null,"errorMessage":"running view command: %w","messagePattern":"running view command: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-editor.go","lineNumber":80,"sourceCode":"\n\twshCmd := wshrpc.CommandCreateBlockData{\n\t\tTabId: tabId,\n\t\tBlockDef: &waveobj.BlockDef{\n\t\t\tMeta: map[string]any{\n\t\t\t\twaveobj.MetaKey_View: \"preview\",\n\t\t\t\twaveobj.MetaKey_File: absFile,\n\t\t\t\twaveobj.MetaKey_Edit: true,\n\t\t\t},\n\t\t},\n\t\tMagnified: editMagnified,\n\t\tFocused:   true,\n\t}\n\tif RpcContext.Conn != \"\" {\n\t\twshCmd.BlockDef.Meta[waveobj.MetaKey_Connection] = RpcContext.Conn\n\t}\n\tblockRef, err := wshclient.CreateBlockCommand(RpcClient, wshCmd, &wshrpc.RpcOpts{Timeout: 2000})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"running view command: %w\", err)\n\t}\n\tdoneCh := make(chan bool)\n\tRpcClient.EventListener.On(wps.Event_BlockClose, func(event *wps.WaveEvent) {\n\t\tif event.HasScope(blockRef.String()) {\n\t\t\tclose(doneCh)\n\t\t}\n\t})\n\twshclient.EventSubCommand(RpcClient, wps.SubscriptionRequest{Event: wps.Event_BlockClose, Scopes: []string{blockRef.String()}}, nil)\n\t<-doneCh\n\treturn nil\n}\n","sourceCodeStart":62,"sourceCodeEnd":92,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-editor.go#L62-L92","documentation":"editorRun calls the CreateBlock RPC (CreateBlockCommand) to open the file in an editor block. Any RPC failure — connection drop, timeout (2000 ms here), server-side block-creation error — is wrapped as \"running view command\".","triggerScenarios":"CreateBlockCommand fails: the wsh RPC connection is down or slow (>2s timeout), the target tab no longer exists, the connection (RpcContext.Conn) is unreachable, or the server rejects the BlockDef.","commonSituations":"Remote host connection is flaky or the SSH connection was dropped; tab was closed between reading WAVETERM_TABID and the RPC; wsh server version mismatch causes the CreateBlock command to be unknown or rejected.","solutions":["Confirm the Wave app is running and the tab referenced by WAVETERM_TABID still exists.","Check network/SSH connectivity to the remote host if --conn was used; re-run after reconnecting.","Retry the command — the 2s timeout can be too short on slow links.","Ensure wsh client and server versions match (run `wsh --version` on both ends and update)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// preflight: ensure the RPC connection is alive\nif RpcContext.Conn != \"\" {\n    if err := wshclient.ConnectionCheckCommand(RpcClient, RpcContext.Conn, &wshrpc.RpcOpts{Timeout: 2000}); err != nil {\n        return fmt.Errorf(\"connection unavailable before creating block\")\n    }\n}","typeGuard":null,"tryCatchPattern":"blockRef, err := wshclient.CreateBlockCommand(RpcClient, wshCmd, &wshrpc.RpcOpts{Timeout: 2000})\nif err != nil {\n    // retry once after short backoff; then surface wrapped error\n}","preventionTips":["Keep the Wave app running and the target tab open","Use a longer RPC timeout on high-latency links","Keep wsh client and server versions in sync"],"tags":["rpc","network","timeout","wave-terminal"],"backgroundTag":"rpc-call-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}