#21008: fix: Rename --url to --cookie-url in browser cookies set
docs
cli
size: XS
Cluster:
Cross-Platform Fixes
## Summary
Fixes #20976
The `browser` parent command has `--url` (Gateway WebSocket URL) via `addGatewayClientOptions`, which collides with `--url` needed by the `cookies set` subcommand (cookie domain URL).
Commander.js can't distinguish between parent and child options with the same name, causing:
```bash
$ openclaw browser cookies set name value --url "https://x.com"
error: required option '--url <url>' not specified
```
## Changes
- Renamed `--url` → `--cookie-url` in cookies set command
- Updated `opts.url` → `opts.cookieUrl` in cookie body
- Updated description to reference `--cookie-url`
## Testing
Updated test suite:
- Added `addGatewayClientOptions` to test to properly simulate the collision
- Updated existing test to use `--cookie-url`
- Added new test case verifying parent `--url` + child `--cookie-url` coexist
```bash
$ pnpm test src/cli/browser-cli-state.option-collisions.test.ts
Test Files 1 passed (1)
Tests 3 passed (3) ✅
```
## Usage After Fix
```bash
$ openclaw browser cookies set session_id 12345 --cookie-url "https://x.com"
cookie set: session_id ✅
```
## Impact
**Low risk** - Changes only CLI flag name. The old `--url` flag was broken due to collision, so no existing working usage is affected.
Closes #20976
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Renamed `--url` to `--cookie-url` in `browser cookies set` command to resolve Commander.js option collision with parent command's `--url` flag (Gateway WebSocket URL).
**Key changes:**
- Updated flag name from `--url` to `--cookie-url` in command definition
- Updated option access from `opts.url` to `opts.cookieUrl` in cookie body
- Added `addGatewayClientOptions` to test setup to properly simulate collision scenario
- Added test case verifying parent `--url` and child `--cookie-url` coexist correctly
**Issues found:**
- Documentation in `docs/tools/browser.md` and `docs/zh-CN/tools/browser.md` still references old `--url` flag and needs updating
<h3>Confidence Score: 4/5</h3>
- Safe to merge after updating documentation to reflect the new flag name
- The code change correctly resolves the Commander.js option collision and is well-tested. Test coverage includes verification that both parent and child options coexist properly. The only issue is outdated documentation that still references `--url` instead of `--cookie-url`, which prevents a score of 5.
- Documentation files `docs/tools/browser.md` and `docs/zh-CN/tools/browser.md` need updates to match the new flag name
<sub>Last reviewed commit: 09abbce</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#21000: fix: resolve option collision between browser and cookies set commands
by MisterGuy420 · 2026-02-19
81.4%
#5094: Fix browser set headers CLI option collision
by JaydenLiang · 2026-01-31
75.7%
#14944: fix(browser): prefer openclaw profile in headless/noSandbox environ...
by BenediktSchackenberg · 2026-02-12
69.0%
#6751: docs(browser): update JSON configuration format in documentation
by saltapp · 2026-02-02
67.9%
#23666: fix(doctor): openclaw-browser.service falsely flagged as duplicate ...
by yinghaosang · 2026-02-22
67.3%
#17645: fix: browser control service actually start HTTP server in Docker
by MisterGuy420 · 2026-02-16
66.7%
#18907: Fix: Improve browser error messages to avoid misleading agents
by jriff · 2026-02-17
66.6%
#11602: fix(config): skip stale legacy config files when openclaw.json exists
by akoscz · 2026-02-08
66.3%
#17760: fix(browser): rewrite 0.0.0.0 and [::] wildcard addresses in CDP We...
by joeharouni · 2026-02-16
66.2%
#6193: fix(browser): default to openclaw profile instead of chrome extensi...
by mikezaoldyeck · 2026-02-01
66.0%