{"record":{"id":"d12a43b61924e2d7","repo":"wavetermdev/waveterm","slug":"unknown-view-q-try-one-of-term-web-preview","errorCode":null,"errorMessage":"unknown --view %q; try one of: term, web, preview, edit, sysinfo, waveai","messagePattern":"unknown --view %q; try one of: term, web, preview, edit, sysinfo, waveai","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-blocks.go","lineNumber":103,"sourceCode":"\t\t}\n\t}\n\n\tblocksCmd := &cobra.Command{\n\t\tUse:     \"blocks\",\n\t\tShort:   \"Manage blocks\",\n\t\tLong:    \"Commands for working with blocks\",\n\t}\n\n\tblocksCmd.AddCommand(blocksListCmd)\n\trootCmd.AddCommand(blocksCmd)\n}\n\n// blocksListRun implements the 'blocks list' command\n// It retrieves and displays blocks with optional filtering by workspace, window, tab, or view type\nfunc blocksListRun(cmd *cobra.Command, args []string) error {\n\tif v := strings.TrimSpace(blocksView); v != \"\" {\n\t\tif !isKnownViewFilter(v) {\n\t\t\treturn fmt.Errorf(\"unknown --view %q; try one of: term, web, preview, edit, sysinfo, waveai\", v)\n\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 != \"\" {","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-blocks.go#L85-L121","documentation":"Validation error from `wsh blocks list --view`. The command accepts only a fixed set of view filter values (term, web, preview, edit, sysinfo, waveai); any other value passed to --view is rejected before any RPC is made. It is a pure input-validation failure controlled entirely by the user's flag value.","triggerScenarios":"Calling `wsh blocks list --view <value>` where <value> is not exactly one of term, web, preview, edit, sysinfo, waveai — including typos (e.g. 'terminal' instead of 'term'), wrong casing if the check is case-sensitive, or empty/whitespace-padded strings that survive TrimSpace.","commonSituations":"Typing the long view name instead of the short one; guessing view names from the UI instead of the documented set; scripting with a variable that contains an unexpected value; older/newer builds where the allowed list differs.","solutions":["Use one of the exact accepted values: term, web, preview, edit, sysinfo, waveai","Run `wsh blocks list --help` to see the currently supported --view values for your build","Trim/lowercase the input in scripts before passing it to --view"],"exampleFix":"// before\nwsh blocks list --view terminal\n// after\nwsh blocks list --view term","handlingStrategy":"validation","validationCode":"var validViews = map[string]bool{\"term\":true,\"web\":true,\"preview\":true,\"edit\":true,\"sysinfo\":true,\"waveai\":true}\nif !validViews[strings.TrimSpace(view)] {\n    return fmt.Errorf(\"--view must be one of term, web, preview, edit, sysinfo, waveai\")\n}","typeGuard":null,"tryCatchPattern":"if err := runBlocksList(); err != nil && strings.Contains(err.Error(), \"unknown --view\") {\n    // correct the flag value and retry\n}","preventionTips":["Copy --view values from `wsh blocks list --help`, not memory","Use short canonical names (term, not terminal)","Trim and normalize view strings in shell scripts"],"tags":["cli","validation","argument-parsing","wsh"],"backgroundTag":"invalid-argument-value","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}