{"record":{"id":"c92887da57ae8971","repo":"wavetermdev/waveterm","slug":"no-waveterm-tabid-env-var-set-c92887","errorCode":null,"errorMessage":"no WAVETERM_TABID env var set","messagePattern":"no WAVETERM_TABID env var set","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-editconfig.go","lineNumber":43,"sourceCode":"\nfunc init() {\n\teditConfigCmd.Flags().BoolVarP(&editConfigMagnified, \"magnified\", \"m\", false, \"open config in magnified mode\")\n\trootCmd.AddCommand(editConfigCmd)\n}\n\nfunc editConfigRun(cmd *cobra.Command, args []string) (rtnErr error) {\n\tdefer func() {\n\t\tsendActivity(\"editconfig\", rtnErr == nil)\n\t}()\n\n\tconfigFile := \"settings.json\" // default\n\tif len(args) > 0 {\n\t\tconfigFile = args[0]\n\t}\n\n\ttabId := getTabIdFromEnv()\n\tif tabId == \"\" {\n\t\treturn fmt.Errorf(\"no WAVETERM_TABID env var set\")\n\t}\n\n\twshCmd := &wshrpc.CommandCreateBlockData{\n\t\tTabId: tabId,\n\t\tBlockDef: &waveobj.BlockDef{\n\t\t\tMeta: map[string]interface{}{\n\t\t\t\twaveobj.MetaKey_View: \"waveconfig\",\n\t\t\t\twaveobj.MetaKey_File: configFile,\n\t\t\t},\n\t\t},\n\t\tMagnified: editConfigMagnified,\n\t\tFocused:   true,\n\t}\n\n\t_, err := wshclient.CreateBlockCommand(RpcClient, *wshCmd, &wshrpc.RpcOpts{Timeout: 2000})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"opening config file: %w\", err)\n\t}","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-editconfig.go#L25-L61","documentation":"editConfigRun needs a tab id to create the config editor block in the current tab, obtained from the WAVETERM_TABID environment variable. When wsh is run outside a Wave terminal block (or the var is unset), getTabIdFromEnv returns \"\" and this error is returned instead of creating the block.","triggerScenarios":"Running `wsh editconfig` in a plain shell/SSH session, an environment where WAVETERM_TABID was cleared, or a non-interactive context spawned without the terminal's env.","commonSituations":"Using wsh over ssh into the same machine but from a non-Wave shell; running from cron/CI; Docker/container shells that don't inherit the terminal's environment.","solutions":["Run `wsh editconfig` inside a Wave terminal block where WAVETERM_TABID is set","Set WAVETERM_TABID to a valid tab id before invoking the command","Use `wsh settab` context or edit ~/.config/waveterm/settings.json directly with a normal editor"],"exampleFix":"// before\n$ plain-shell$ wsh editconfig  # error\n// after\n$ export WAVETERM_TABID=<tab-id>\n$ wsh editconfig","handlingStrategy":"validation","validationCode":"tabId := os.Getenv(\"WAVETERM_TABID\")\nif tabId == \"\" {\n    return errors.New(\"run inside a Wave terminal block or set WAVETERM_TABID\")\n}","typeGuard":null,"tryCatchPattern":"if err := wsh.EditConfig(); err != nil {\n    if strings.Contains(err.Error(), \"WAVETERM_TABID\") {\n        // fall back to opening the config file with a local editor\n    }\n}","preventionTips":["Only run wsh UI-opening commands from inside Wave terminal blocks","Don't scrub WAVETERM_* vars in shell profiles","For CI/remote shells, edit ~/.config/waveterm/settings.json directly"],"tags":["cli","environment","missing-env-var"],"backgroundTag":"missing-env-var","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}