{"record":{"id":"15fd4e8af0a8edeb","repo":"wavetermdev/waveterm","slug":"workspace-and-window-are-mutually-exclusive-s","errorCode":null,"errorMessage":"--workspace and --window are mutually exclusive; specify only one","messagePattern":"--workspace and --window are mutually exclusive; specify only one","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-blocks.go","lineNumber":122,"sourceCode":"\t\t}\n\t}\n\n\tvar allBlocks []BlockDetails\n\n\tworkspaces, err := wshclient.WorkspaceListCommand(RpcClient, &wshrpc.RpcOpts{Timeout: int64(blocksTimeout)})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to list workspaces: %v\", err)\n\t}\n\n\tif len(workspaces) == 0 {\n\t\treturn fmt.Errorf(\"no workspaces found\")\n\t}\n\n\tvar workspaceIdsToQuery []string\n\n\t// Determine which workspaces to query\n\tif blocksWorkspaceId != \"\" && blocksWindowId != \"\" {\n\t\treturn fmt.Errorf(\"--workspace and --window are mutually exclusive; specify only one\")\n\t}\n\tif blocksWorkspaceId != \"\" {\n\t\tworkspaceIdsToQuery = []string{blocksWorkspaceId}\n\t} else if blocksWindowId != \"\" {\n\t\t// Find workspace ID for this window\n\t\twindowFound := false\n\t\tfor _, ws := range workspaces {\n\t\t\tif ws.WindowId == blocksWindowId {\n\t\t\t\tworkspaceIdsToQuery = []string{ws.WorkspaceData.OID}\n\t\t\t\twindowFound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !windowFound {\n\t\t\treturn fmt.Errorf(\"window %s not found\", blocksWindowId)\n\t\t}\n\t} else {\n\t\t// Default to all workspaces","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-blocks.go#L104-L140","documentation":"Argument-validation error from `wsh blocks list` when both --workspace and --window flags are supplied. The two flags are alternative ways to scope the block listing, and the command forbids combining them. Thrown before any RPC other than the workspace listing is performed.","triggerScenarios":"Invoking `wsh blocks list --workspace <id> --window <id>` — both non-empty flag values trigger the mutually-exclusive check.","commonSituations":"Script templates that always pass both flags (one possibly filled with a stale/default value); users unaware only one scope may be given; shell aliases appending flags.","solutions":["Remove either --workspace or --window, keeping only the scope you want","In scripts, pass only the flag whose ID you resolved, e.g. build the command conditionally","Use --window when you know the window id and --workspace when you know the workspace id, never both"],"exampleFix":"// before\nwsh blocks list --workspace $WS --window $WIN\n// after\nwsh blocks list --workspace $WS","handlingStrategy":"validation","validationCode":"if workspaceId != \"\" && windowId != \"\" {\n    return fmt.Errorf(\"pass either --workspace or --window, not both\")\n}","typeGuard":null,"tryCatchPattern":"if err := runBlocksList(); err != nil && strings.Contains(err.Error(), \"mutually exclusive\") {\n    // drop one flag and rerun\n}","preventionTips":["In scripts, resolve the scope id first and pass exactly one flag","Never hardcode both flags in shell aliases/templates","Choose --workspace when filtering by workspace, --window only for a single window"],"tags":["cli","validation","flags","wsh"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}