{"record":{"id":"d5d96f981d4921dd","repo":"wavetermdev/waveterm","slug":"block-s-is-not-a-terminal-block-view-type-s","errorCode":null,"errorMessage":"block %s is not a terminal block (view type: %s)","messagePattern":"block (.+?) is not a terminal block \\(view type: (.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-termscrollback.go","lineNumber":68,"sourceCode":"\n\t// Resolve the block argument\n\tfullORef, err := resolveBlockArg()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Get block metadata to verify it's a terminal block\n\tmetaData, err := wshclient.GetMetaCommand(RpcClient, wshrpc.CommandGetMetaData{\n\t\tORef: *fullORef,\n\t}, &wshrpc.RpcOpts{Timeout: 2000})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error getting block metadata: %w\", err)\n\t}\n\n\t// Check if the block is a terminal block\n\tviewType, ok := metaData[waveobj.MetaKey_View].(string)\n\tif !ok || viewType != \"term\" {\n\t\treturn fmt.Errorf(\"block %s is not a terminal block (view type: %s)\", fullORef.OID, viewType)\n\t}\n\n\t// Make the RPC call to get scrollback\n\tscrollbackData := wshrpc.CommandTermGetScrollbackLinesData{\n\t\tLineStart:   termScrollbackLineStart,\n\t\tLineEnd:     termScrollbackLineEnd,\n\t\tLastCommand: termScrollbackLastCmd,\n\t}\n\n\tresult, err := wshclient.TermGetScrollbackLinesCommand(RpcClient, scrollbackData, &wshrpc.RpcOpts{\n\t\tRoute:   wshutil.MakeFeBlockRouteId(fullORef.OID),\n\t\tTimeout: 5000,\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error getting terminal scrollback: %w\", err)\n\t}\n\n\t// Format the output","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-termscrollback.go#L50-L86","documentation":"After fetching block metadata, wsh validates that the block's meta[MetaKey_View] equals \"term\". If the key is missing or any non-\"term\" value (e.g. \"preview\", \"web\"), it refuses to fetch scrollback with this error.","triggerScenarios":"`wsh termescrollback <oid>` on a block whose view type is not a terminal — passing a preview/editor/web block OID, or a typo'd OID that resolves to the wrong block.","commonSituations":"Copying an OID from the wrong block; pointing the command at a config or file block; a block whose meta was changed so the view key no longer reads \"term\".","solutions":["Target a terminal block: get the correct OID from the Wave UI block menu.","Check the block's meta with `wsh getmeta <oid>` and confirm view == \"term\".","If the block should be a terminal but isn't, fix its meta (`wsh setmeta <oid> view:term`)."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"meta, _ := wshclient.GetMetaCommand(RpcClient, wshrpc.CommandGetMetaData{ORef: *fullORef}, nil)\nif v, _ := meta[waveobj.MetaKey_View].(string); v != \"term\" {\n\tfmt.Fprintf(os.Stderr, \"block %s is not a terminal block\\n\", fullORef.OID)\n\tos.Exit(1)\n}","typeGuard":"func isTerminalBlock(meta map[string]any) bool {\n\tv, ok := meta[waveobj.MetaKey_View].(string)\n\treturn ok && v == \"term\"\n}","tryCatchPattern":"viewType, ok := metaData[waveobj.MetaKey_View].(string)\nif !ok || viewType != \"term\" {\n\t// handle non-terminal block: exit gracefully or prompt for a different OID\n}","preventionTips":["Verify view type with `wsh getmeta <oid>` before fetching scrollback.","Only pass OIDs sourced from terminal blocks.","If scripting, filter block lists by meta view == \"term\" first."],"tags":["validation","cli","terminal"],"backgroundTag":"wrong-block-type","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}