wavetermdev/waveterm · error

delete block failed: %v

Error message

delete block failed: %v

What it means

The DeleteBlockCommand RPC (timeout 2000ms) returned an error; deleteBlockRun wraps it as "delete block failed". This means the client reached the server but the server-side delete was rejected or the RPC timed out.

Source

Thrown at cmd/wsh/cmd/wshcmd-deleteblock.go:47

		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

  1. Confirm the block still exists and get its current id
  2. Retry the command (transient connection or timeout failures)
  3. Check that the wsh RPC connection is healthy (`wsh status`)
  4. Inspect the wrapped inner error (%v output) for the server's reason

Example fix

// before
wsh deleteblock 42
// error: delete block failed: timeout after 2000ms
// after
wsh status   # verify connection
wsh deleteblock 42   # retry once connection is up
Defensive patterns

Strategy: retry

Validate before calling

if _, err := wshclient.BlockGetCommand(rpc, blockId, nil); err != nil {
    return fmt.Errorf("block %s not present; nothing to delete", blockId)
}

Try / catch

if err := deleteBlock(id); err != nil {
    var timeout err
    if strings.Contains(err.Error(), "timeout") {
        time.Sleep(500 * time.Millisecond)
        err = deleteBlock(id) // one retry
    }
}

Prevention

When it happens

Trigger: DeleteBlockCommand failing due to a nonexistent block id, permission rejection, a disconnected/routing error to the workspace, or exceeding the 2000ms timeout.

Common situations: Deleting a block that was already closed in the UI; stale block id after a window restart; RPC connection to a remote workspace dropped.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/0bfadc907fe78714. Report an issue: GitHub.