zeroclaw-labs/zeroclaw · error

Browser tool is enabled but no allowed_domains are configure

Error message

Browser tool is enabled but no allowed_domains are configured. Add [browser].allowed_domains in config.toml

What it means

browser_open is fail-closed: if both allowed_domains and allowed_private_hosts are empty, every URL is rejected with this configuration error, because an allowlist-less browser tool would open anything. The message points at the fix — [browser].allowed_domains in config.toml.

Source

Thrown at crates/zeroclaw-tools/src/browser_open.rs:59

    }

    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);
        let private_host_allowed = private_host
            && domain_guard::host_matches_allowlist(&host, &self.allowed_private_hosts);

        if private_host && !private_host_allowed {
            anyhow::bail!("Blocked local/private host: {host}");
        }

        if private_host_allowed {
            return Ok(url.to_string());
        }

        if !domain_guard::host_matches_allowlist(&host, &self.allowed_domains) {

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Add [browser] allowed_domains = ["example.com", ...] to config.toml and restart
  2. For local development targets, use [browser].allowed_private_hosts instead
  3. Verify the TOML section and key names match the schema exactly so the lists actually load

Example fix

# config.toml — before
# (no [browser] section)

# after
[browser]
allowed_domains = ["example.com", "docs.example.com"]
Defensive patterns

Strategy: validation

Validate before calling

// startup check before wiring the tool
if allowed_domains.is_empty() && allowed_private_hosts.is_empty() {
    return Err("browser_open enabled without [browser].allowed_domains — refusing to start fail-open".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("no allowed_domains are configured") {
            // configuration error: fix config.toml and restart, not retryable
        }
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Enabling the browser_open tool without configuring [browser].allowed_domains (and not configuring allowed_private_hosts either), then invoking it with any URL.

Common situations: Fresh installs where the tool ships disabled and gets enabled without its config section; TOML typos such as [browser_allowed] so the section is never read; teams removing a broad wildcard entry for security and forgetting the tool now refuses everything.

Related errors


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/40a5ede9e0ab3263. Report an issue: GitHub.