{"record":{"id":"974c584458d9bd9f","repo":"wavetermdev/waveterm","slug":"no-waveterm-tabid-env-var-set-974c58","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-web.go","lineNumber":117,"sourceCode":"\tdefer func() {\n\t\tsendActivity(\"web\", rtnErr == nil)\n\t}()\n\n\tvar replaceBlockORef *waveobj.ORef\n\tif webOpenReplaceBlock != \"\" {\n\t\tvar err error\n\t\treplaceBlockORef, err = resolveSimpleId(webOpenReplaceBlock)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"resolving -r blockid: %w\", err)\n\t\t}\n\t}\n\tif replaceBlockORef != nil && webOpenMagnified {\n\t\treturn fmt.Errorf(\"cannot use --replace and --magnified together\")\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]any{\n\t\t\t\twaveobj.MetaKey_View: \"web\",\n\t\t\t\twaveobj.MetaKey_Url:  args[0],\n\t\t\t},\n\t\t},\n\t\tMagnified: webOpenMagnified,\n\t\tFocused:   true,\n\t}\n\tif replaceBlockORef != nil {\n\t\twshCmd.TargetBlockId = replaceBlockORef.OID\n\t\twshCmd.TargetAction = wshrpc.CreateBlockAction_Replace\n\t}\n\toref, err := wshclient.CreateBlockCommand(RpcClient, wshCmd, nil)","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-web.go#L99-L135","documentation":"webOpenRun needs the current tab id to create the web block; it reads it from the WAVETERM_TABID environment variable via getTabIdFromEnv(). If the variable is empty, the command cannot know where to create the block and errors out.","triggerScenarios":"Running `wsh web open <url>` from a plain terminal, SSH session, or CI shell where the wsh invocation is not attached to a Wave Terminal tab (WAVETERM_TABID unset).","commonSituations":"Running wsh from outside the integrated terminal; env vars lost via sudo/su or a different user; remote wsh usage without the connection context.","solutions":["Run the command from a terminal inside Wave Terminal so WAVETERM_TABID is exported","Export WAVETERM_TABID manually with a valid tab id if scripting","Use --blockid/--replace with an explicit block when tab context is unavailable"],"exampleFix":"// before (plain shell)\nwsh web open https://example.com\n// after\nexport WAVETERM_TABID=<tab-id> && wsh web open https://example.com","handlingStrategy":"validation","validationCode":"if os.Getenv(\"WAVETERM_TABID\") == \"\" {\n    return errors.New(\"run from a Wave Terminal tab or set WAVETERM_TABID\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run wsh web open from inside Wave's integrated terminal","Export WAVETERM_TABID explicitly in scripts","Fail fast with a clear message when the var is missing"],"tags":["cli","environment","wave-terminal"],"backgroundTag":"missing-env-var","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}