wavetermdev/waveterm · error
object reference is not a block
Error message
object reference is not a block
What it means
deleteBlockRun resolves the block argument to a full object reference and requires its OType to be exactly "block". If the reference resolves to another object type (file, job, applet, etc.), the command refuses to delete it and returns this error before issuing the DeleteBlockCommand RPC.
Source
Thrown at cmd/wsh/cmd/wshcmd-deleteblock.go:40
func init() {
rootCmd.AddCommand(deleteBlockCmd)
}
func deleteBlockRun(cmd *cobra.Command, args []string) (rtnErr error) {
defer func() {
sendActivity("deleteblock", rtnErr == nil)
}()
var blockRef string
if len(args) > 0 {
blockRef = args[0]
}
fullORef, err := resolveBlockArgWithOverride(blockRef)
if err != nil {
return err
}
if fullORef.OType != "block" {
return fmt.Errorf("object reference is not a block")
}
deleteBlockData := &wshrpc.CommandDeleteBlockData{
BlockId: fullORef.OID,
}
err = wshclient.DeleteBlockCommand(RpcClient, *deleteBlockData, &wshrpc.RpcOpts{Timeout: 2000})
if err != nil {
return fmt.Errorf("delete block failed: %v", err)
}
WriteStdout("block deleted\n")
return nil
}
View on GitHub (pinned to a4447c1563)
Solutions
- Verify the object type with `wsh obj` or block info before deleting
- Pass the OID of an actual block (terminal, preview, etc.)
- Re-run with the correct block id from `wsh ls` / getblocks
Example fix
// before wsh deleteblock <file-oid> // after wsh deleteblock <block-oid>
Defensive patterns
Strategy: type-guard
Validate before calling
oref, err := wshclient.ResolveBlockCommand(rpc, blockId, nil)
if err != nil || oref.OType != "block" {
return fmt.Errorf("%s is not a block", blockId)
} Type guard
func isBlockRef(oref waveobj.ORef) bool {
return oref.OType == "block"
} Try / catch
if err := runDeleteBlock(ref); err != nil {
if strings.Contains(err.Error(), "object reference is not a block") {
// resolve the actual block id and retry
}
} Prevention
- Copy block OIDs from `wsh ls`/block info, not file listings
- Check OType before passing any ORef to block commands
- Don't confuse file objects with blocks in scripts
When it happens
Trigger: Calling `wsh deleteblock` with a reference (OID or name) that resolves to a non-block object, e.g. a file or job object.
Common situations: Passing a file OID instead of a terminal/preview block id; using a bookmark or object name that shadows a non-block object; copying the wrong OID from block info.
Related errors
- badge oref must be a block or tab (got %q)
- unknown --view %q; try one of: term, web, preview, edit, sys
- --workspace and --window are mutually exclusive; specify onl
- cannot parse connection name: %w
- --conn parameter is required
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/a37a0caaf5e3a389.
Report an issue: GitHub.