{"record":{"id":"36cde71efd55930f","repo":"wavetermdev/waveterm","slug":"getting-variables-w","errorCode":null,"errorMessage":"getting variables: %w","messagePattern":"getting variables: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-getvar.go","lineNumber":118,"sourceCode":"\t}\n\n\tWriteStdout(\"%s\", resp.Val)\n\tif shouldPrintNewline() {\n\t\tWriteStdout(\"\\n\")\n\t}\n\n\treturn nil\n}\n\nfunc getAllVariables(zoneId string) error {\n\tcommandData := wshrpc.CommandVarData{\n\t\tZoneId:   zoneId,\n\t\tFileName: getVarFileName,\n\t}\n\n\tvars, err := wshclient.GetAllVarsCommand(RpcClient, commandData, &wshrpc.RpcOpts{Timeout: 2000})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting variables: %w\", err)\n\t}\n\n\tterminator := \"\\n\"\n\tif getVarNullTerminate {\n\t\tterminator = \"\\x00\"\n\t}\n\n\tfor _, v := range vars {\n\t\tWriteStdout(\"%s=%s%s\", v.Key, v.Val, terminator)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":100,"sourceCodeEnd":132,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-getvar.go#L100-L132","documentation":"getAllVariables wraps failures of the GetAllVarsCommand RPC (2s timeout) with this message (cmd/wshcmd-getvar.go:118). It is raised when the bulk variable dump RPC cannot be completed — transport failure, timeout, or server-side error — and is only reachable via `wsh getvar --all`.","triggerScenarios":"Running `wsh getvar --all` when the RPC to the resolved zone (block OID or client) fails or exceeds the 2000ms timeout.","commonSituations":"Remote/ssh session with a dropped Wave connection; targeting a stale block id; app busy so the 2s timeout expires; varfile name issues surfaced server-side.","solutions":["Confirm connectivity (Wave app running, connection up) and retry `wsh getvar --all`","Re-resolve the target block — the OID may be stale if the block was closed","If the environment is slow, note the fixed 2s timeout; ensure the machine is not overloaded"],"exampleFix":"// before\nwsh getvar --all --block <closed-blockid>  # rpc fails\n// after\nwsh ls   # find a live block id\nwsh getvar --all --block <live-blockid>","handlingStrategy":"try-catch","validationCode":"wsh conn show || { echo 'no connection'; exit 1; }","typeGuard":null,"tryCatchPattern":"if ! wsh getvar --all >vars.txt 2>err.txt; then\n  grep -qi 'timeout' err.txt && echo 'RPC timed out; retry when app is less busy'\n  exit 1\nfi","preventionTips":["Verify the target block OID is still live before dumping vars","Use a stable connection for scripted bulk reads","Treat repeated failures as a connectivity problem, not a data problem"],"tags":["rpc","network","wsh"],"backgroundTag":"rpc-request-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}