zeroclaw-labs/zeroclaw · error
URL cannot be empty
Error message
URL cannot be empty
What it means
browser_open trims the raw url argument and rejects it if nothing remains. This is the first guard in validate_url; an empty URL cannot be allowlisted or opened, and failing closed here gives a clearer error than a downstream launcher failure.
Source
Thrown at crates/zeroclaw-tools/src/browser_open.rs:47
) -> anyhow::Result<Self> {
Ok(Self {
security,
allowed_domains: domain_guard::normalize_allowed_domains(
allowed_domains,
"browser.allowed_domains",
)?,
allowed_private_hosts: domain_guard::normalize_allowed_domains(
allowed_private_hosts,
"browser.allowed_private_hosts",
)?,
})
}
fn validate_url(&self, raw_url: &str) -> anyhow::Result<String> {
let url = raw_url.trim();
if url.is_empty() {
anyhow::bail!("URL cannot be empty");
}
if url.chars().any(char::is_whitespace) {
anyhow::bail!("URL cannot contain whitespace");
}
if !(url.starts_with("https://") || url.starts_with("http://")) {
anyhow::bail!("Only http:// or https:// URLs are allowed");
}
if self.allowed_domains.is_empty() && self.allowed_private_hosts.is_empty() {
anyhow::bail!(
"Browser tool is enabled but no allowed_domains are configured. Add [browser].allowed_domains in config.toml"
);
}
let host = extract_host(url)?;
let private_host = domain_guard::is_private_or_local_host(&host);View on GitHub (pinned to 88bb9c8533)
Solutions
- Pass a complete absolute URL ("https://example.com")
- Make a missing URL a hard error at the call site instead of defaulting to an empty string
- Trim and check is_empty() before invoking the tool
Example fix
// before
{"url": ""}
// after
{"url": "https://example.com"} Defensive patterns
Strategy: validation
Validate before calling
let url = raw_url.trim();
if url.is_empty() {
return Err("URL cannot be empty".into());
} Try / catch
match open_tool.execute(args).await {
Ok(res) if res.success => { /* ... */ }
Ok(res) => {
if res.error.as_deref().unwrap_or_default().contains("URL cannot be empty") {
// fill in the URL at the source; do not retry with ""
}
}
Err(e) => return Err(e),
} Prevention
- Reject empty URLs at the call site with a clear message
- Never default missing URL parameters to an empty string
When it happens
Trigger: Calling the browser_open tool with url="", url=" ", or any value that is only whitespace after trim (e.g. a variable that was never filled in).
Common situations: Template or format! bugs producing an empty string; the model omitting the URL and caller code defaulting to ""; whitespace-only input from misparsed upstream configuration.
Related errors
- URL cannot contain whitespace
- Only http:// or https:// URLs are allowed
- providers.models.{profile_name}.uri must use http/https
- Custom model_provider `{prefix}:<url>` requires a URL beginn
- OpenAI Codex endpoint override cannot be empty
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/7409792a4a971e1b.
Report an issue: GitHub.