{"record":{"id":"c2caa39611059130","repo":"wavetermdev/waveterm","slug":"no-waveterm-tabid-env-var-set-c2caa3","errorCode":null,"errorMessage":"no WAVETERM_TABID env var set","messagePattern":"no WAVETERM_TABID env var set","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-wavepath.go","lineNumber":61,"sourceCode":"\t}\n\n\tpathType := args[0]\n\tif pathType != \"config\" && pathType != \"data\" && pathType != \"log\" {\n\t\tOutputHelpMessage(cmd)\n\t\treturn fmt.Errorf(\"invalid path type %q. must be one of: config, data, log\", pathType)\n\t}\n\n\ttail, _ := cmd.Flags().GetBool(\"tail\")\n\tif tail && pathType != \"log\" {\n\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","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-wavepath.go#L43-L79","documentation":"wsh wavepath runs inside the Wave terminal environment and derives the target tab from the WAVETERM_TABID env var, which the terminal injects into wsh subprocesses. If it is empty, wavepathRun cannot resolve which tab's path to request and fails before issuing the RPC.","triggerScenarios":"Running `wsh wavepath ...` outside a Wave terminal (plain shell, CI, SSH session, editor terminal launched before Wave env was loaded) or with WAVETERM_TABID explicitly unset/emptied.","commonSituations":"Running wsh from bash/zsh started independently of Wave, Docker containers, cron jobs, or after `env -i` / `unset WAVETERM_TABID` in scripts.","solutions":["Run the command from a shell spawned inside Wave Terminal so WAVETERM_TABID is set.","Verify with `echo $WAVETERM_TABID`; if empty, relaunch the shell from within Wave.","Explicitly export WAVETERM_TABID=<tabid> for headless/scripted use."],"exampleFix":"// before (plain shell)\nwsh wavepath log\n// after\nexport WAVETERM_TABID=<tab-id>\nwsh wavepath log","handlingStrategy":"validation","validationCode":"if [ -z \"$WAVETERM_TABID\" ]; then echo \"run inside Wave Terminal or export WAVETERM_TABID\" >&2; exit 1; fi","typeGuard":null,"tryCatchPattern":"if err := runWavepath(); err != nil { if strings.Contains(err.Error(), \"WAVETERM_TABID\") { fallbackToNonTabPath() } else { return err } }","preventionTips":["Run wsh commands from shells spawned inside Wave Terminal.","Assert WAVETERM_TABID is set in CI/script preambles.","Don't unset Wave-injected env vars in wrapper scripts."],"tags":["cli","environment","env-var","wsh"],"backgroundTag":"missing-env-var","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}