{"record":{"id":"c4a6e36109d39110","repo":"wavetermdev/waveterm","slug":"setting-connection-in-block-w-c4a6e3","errorCode":null,"errorMessage":"setting connection in block: %w","messagePattern":"setting connection in block: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-wsl.go","lineNumber":59,"sourceCode":"\t\t\treturn err\n\t\t}\n\t}\n\tif !strings.HasPrefix(distroName, \"wsl://\") {\n\t\tdistroName = \"wsl://\" + distroName\n\t}\n\tblockId := RpcContext.BlockId\n\tif blockId == \"\" {\n\t\treturn fmt.Errorf(\"cannot determine blockid (not in JWT)\")\n\t}\n\tdata := wshrpc.CommandSetMetaData{\n\t\tORef: waveobj.MakeORef(waveobj.OType_Block, blockId),\n\t\tMeta: map[string]any{\n\t\t\twaveobj.MetaKey_Connection: distroName,\n\t\t},\n\t}\n\terr = wshclient.SetMetaCommand(RpcClient, data, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"setting connection in block: %w\", err)\n\t}\n\tWriteStderr(\"switched connection to %q\\n\", distroName)\n\treturn nil\n}\n","sourceCodeStart":41,"sourceCodeEnd":64,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-wsl.go#L41-L64","documentation":"wslRun calls SetMetaCommand to persist the distro name as the block's connection meta. If the RPC fails (block gone, disconnected client, server error), the cause is wrapped with \"setting connection in block:\".","triggerScenarios":"`wsh wsl set <distro>` where the block identified by the JWT was closed before the call, the WSL connection name is invalid, or the wsh RPC connection to the Wave server failed.","commonSituations":"Typos in the distro name; block closed while command ran; running from a stale shell after Wave restarted.","solutions":["Confirm the distro name (e.g. \"Ubuntu-22.04\") and retry","Ensure the originating Wave block is still open and Wave is running","Re-run from a fresh Wave terminal to get a fresh JWT/context"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"err = wshclient.SetMetaCommand(RpcClient, data, nil)\nif err != nil {\n    return fmt.Errorf(\"setting connection in block: %w\", err)\n}","preventionTips":["Verify the distro name exists (wsl -l) before setting","Retry once on transient RPC errors","Ensure the block is open for the duration of the command"],"tags":["cli","rpc","wsl"],"backgroundTag":"set-meta-rpc-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}