wavetermdev/waveterm · error
cannot use --replace and --magnified together
Error message
cannot use --replace and --magnified together
What it means
Returned by wsh web when both --replace and --magnified flags are set; they are mutually exclusive viewing modes.
Source
Thrown at cmd/wsh/cmd/wshcmd-web.go:112
}
return nil
}
func webOpenRun(cmd *cobra.Command, args []string) (rtnErr error) {
defer func() {
sendActivity("web", rtnErr == nil)
}()
var replaceBlockORef *waveobj.ORef
if webOpenReplaceBlock != "" {
var err error
replaceBlockORef, err = resolveSimpleId(webOpenReplaceBlock)
if err != nil {
return fmt.Errorf("resolving -r blockid: %w", err)
}
}
if replaceBlockORef != nil && webOpenMagnified {
return fmt.Errorf("cannot use --replace and --magnified together")
}
tabId := getTabIdFromEnv()
if tabId == "" {
return fmt.Errorf("no WAVETERM_TABID env var set")
}
wshCmd := wshrpc.CommandCreateBlockData{
TabId: tabId,
BlockDef: &waveobj.BlockDef{
Meta: map[string]any{
waveobj.MetaKey_View: "web",
waveobj.MetaKey_Url: args[0],
},
},
Magnified: webOpenMagnified,
Focused: true,
}View on GitHub (pinned to a4447c1563)
Solutions
- Drop --magnified when replacing a block
- Drop --replace when a magnified new block is desired
- Split into two commands if both behaviors are needed
Example fix
// before wsh web open https://example.com --replace abc --magnified // after wsh web open https://example.com --replace abc
Defensive patterns
Strategy: validation
Validate before calling
if webOpenReplaceBlock != "" && webOpenMagnified {
return errors.New("cannot use --replace and --magnified together")
} Prevention
- Document mutually exclusive flags in scripts
- Check `wsh web open --help` before composing flag sets
- Wrap common flag combos in shell functions
When it happens
Trigger: `wsh web open <url> --replace <oid> --magnified` — replaceBlockORef resolved successfully but webOpenMagnified is also true.
Common situations: Combining flags from an old command alias or script; misunderstanding that a replaced block cannot also be magnified.
Understand the failure class
Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.
Related errors
- cannot specify key with --all
- requires a key argument
- setbg requires an image path or color value
- no files or message provided
- too many files (maximum %d files allowed)
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/1362bef794844385.
Report an issue: GitHub.