{"record":{"id":"afe1af6c2c776d1e","repo":"wavetermdev/waveterm","slug":"getting-path-w","errorCode":null,"errorMessage":"getting path: %w","messagePattern":"getting path: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-wavepath.go","lineNumber":71,"sourceCode":"\t\treturn fmt.Errorf(\"--tail can only be used with the log path type\")\n\t}\n\n\topen, _ := cmd.Flags().GetBool(\"open\")\n\topenExternal, _ := cmd.Flags().GetBool(\"open-external\")\n\n\ttabId := getTabIdFromEnv()\n\tif tabId == \"\" {\n\t\treturn fmt.Errorf(\"no WAVETERM_TABID env var set\")\n\t}\n\n\tpath, err := wshclient.PathCommand(RpcClient, wshrpc.PathCommandData{\n\t\tPathType:     pathType,\n\t\tOpen:         open,\n\t\tOpenExternal: openExternal,\n\t\tTabId:        tabId,\n\t}, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting path: %w\", err)\n\t}\n\n\tif tail && pathType == \"log\" {\n\t\terr = tailLogFile(path)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"tailing log file: %w\", err)\n\t\t}\n\t\treturn nil\n\t}\n\n\tWriteStdout(\"%s\\n\", path)\n\treturn nil\n}\n\nfunc tailLogFile(path string) error {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"opening log file: %w\", err)","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-wavepath.go#L53-L89","documentation":"This wraps any error returned by the wshclient.PathCommand RPC, which asks the Wave server for the requested path. The failure happened server-side or in transport, not in local argument validation; the original error is preserved via %w.","triggerScenarios":"The RPC to the Wave server fails: no connection to the terminal, server rejected the path type or tab id, or the underlying path lookup fails (e.g. wave data dir missing, permission denied).","commonSituations":"wsh run against an unreachable/stale terminal connection, an invalid TabId pointing to a closed tab, or OS-level permission problems on the Wave config/data/log directories.","solutions":["Inspect the wrapped cause in the error output for the root reason (connection vs. path).","Verify the terminal connection: run another wsh RPC command like `wsh ls` to test connectivity.","Check that the WAVETERM_TABID refers to an open tab.","Check OS permissions on the Wave config/data/log directories."],"exampleFix":"// before\ntabId := getTabIdFromEnv()\n// after\nif tabId == \"\" { return errors.New(\"WAVETERM_TABID not set\") } // catch stale/empty tab ids before RPC","handlingStrategy":"try-catch","validationCode":"wsh ls >/dev/null 2>&1 || { echo \"wsh RPC unavailable\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":"path, err := wshclient.PathCommand(RpcClient, data, nil)\nif err != nil {\n    var connErr *net.OpError\n    if errors.As(err, &connErr) { /* reconnect terminal */ }\n    return fmt.Errorf(\"getting path: %w\", err)\n}","preventionTips":["Test RPC connectivity with a cheap command before scripting against wsh.","Keep Wave Terminal running and connections fresh.","Check the wrapped cause with errors.Unwrap/As for the root reason."],"tags":["rpc","network","wsh","error-wrapping"],"backgroundTag":"rpc-call-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}