{"record":{"id":"0bfadc907fe78714","repo":"wavetermdev/waveterm","slug":"delete-block-failed-v","errorCode":null,"errorMessage":"delete block failed: %v","messagePattern":"delete block failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-deleteblock.go","lineNumber":47,"sourceCode":"\t\tsendActivity(\"deleteblock\", rtnErr == nil)\n\t}()\n\tvar blockRef string\n\tif len(args) > 0 {\n\t\tblockRef = args[0]\n\t}\n\tfullORef, err := resolveBlockArgWithOverride(blockRef)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif fullORef.OType != \"block\" {\n\t\treturn fmt.Errorf(\"object reference is not a block\")\n\t}\n\tdeleteBlockData := &wshrpc.CommandDeleteBlockData{\n\t\tBlockId: fullORef.OID,\n\t}\n\terr = wshclient.DeleteBlockCommand(RpcClient, *deleteBlockData, &wshrpc.RpcOpts{Timeout: 2000})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"delete block failed: %v\", err)\n\t}\n\tWriteStdout(\"block deleted\\n\")\n\treturn nil\n}\n","sourceCodeStart":29,"sourceCodeEnd":52,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-deleteblock.go#L29-L52","documentation":"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.","triggerScenarios":"DeleteBlockCommand failing due to a nonexistent block id, permission rejection, a disconnected/routing error to the workspace, or exceeding the 2000ms timeout.","commonSituations":"Deleting a block that was already closed in the UI; stale block id after a window restart; RPC connection to a remote workspace dropped.","solutions":["Confirm the block still exists and get its current id","Retry the command (transient connection or timeout failures)","Check that the wsh RPC connection is healthy (`wsh status`)","Inspect the wrapped inner error (%v output) for the server's reason"],"exampleFix":"// before\nwsh deleteblock 42\n// error: delete block failed: timeout after 2000ms\n// after\nwsh status   # verify connection\nwsh deleteblock 42   # retry once connection is up","handlingStrategy":"retry","validationCode":"if _, err := wshclient.BlockGetCommand(rpc, blockId, nil); err != nil {\n    return fmt.Errorf(\"block %s not present; nothing to delete\", blockId)\n}","typeGuard":null,"tryCatchPattern":"if err := deleteBlock(id); err != nil {\n    var timeout err\n    if strings.Contains(err.Error(), \"timeout\") {\n        time.Sleep(500 * time.Millisecond)\n        err = deleteBlock(id) // one retry\n    }\n}","preventionTips":["Ensure `wsh status` shows a healthy RPC connection before bulk deletes","Handle already-deleted blocks idempotently in scripts","Keep timeouts realistic; retry transient RPC failures"],"tags":["rpc","network","block"],"backgroundTag":"rpc-call-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}