zeroclaw-labs/zeroclaw · error · anyhow::Error

--level domain-block requires at least one --domain

Error message

--level domain-block requires at least one --domain

What it means

Argument-consistency guard in the ESTOP command parser. --level domain-block means 'cut network access to specific domains', so at least one --domain flag is required to name them; specifying none would produce a level that blocks nothing. The companion check rejects --tool with this level. Use --level domain-block with one or more --domain values.

Solutions

  1. Add one or more `--domain <host>` values
  2. Check flag spelling and shell expansion: the flag is `--domain` (repeatable) and variables must expand non-empty
  3. Use no `--level` (kill-all default) if a global stop was intended

Example fix

# before
zeroclaw estop --level domain-block
# after
zeroclaw estop --level domain-block --domain api.example.com
Defensive patterns

Strategy: validation

Validate before calling

if [ "$level" = "domain-block" ] && [ "${#domains[@]}" -eq 0 ]; then
  echo "--level domain-block requires at least one --domain"; exit 2
fi

Prevention

When it happens

Trigger: `zeroclaw estop --level domain-block` with no `--domain` flags supplied.

Common situations: Typo in the flag name (`--domains`); flags lost behind a `--` separator or unexpanded empty shell variable in scripts; forgetting the selector when switching from kill-all.

Understand the failure class

Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at src/main.rs:6597

    tools: Vec<String>,
) -> Result<security::EstopLevel> {
    let requested = level.unwrap_or(EstopLevelArg::KillAll);
    match requested {
        EstopLevelArg::KillAll => {
            if !domains.is_empty() || !tools.is_empty() {
                bail!("--domain/--tool are only valid with --level domain-block/tool-freeze");
            }
            Ok(security::EstopLevel::KillAll)
        }
        EstopLevelArg::NetworkKill => {
            if !domains.is_empty() || !tools.is_empty() {
                bail!("--domain/--tool are not valid with --level network-kill");
            }
            Ok(security::EstopLevel::NetworkKill)
        }
        EstopLevelArg::DomainBlock => {
            if domains.is_empty() {
                bail!("--level domain-block requires at least one --domain");
            }
            if !tools.is_empty() {
                bail!("--tool is not valid with --level domain-block");
            }
            Ok(security::EstopLevel::DomainBlock(domains))
        }
        EstopLevelArg::ToolFreeze => {
            if tools.is_empty() {
                bail!("--level tool-freeze requires at least one --tool");
            }
            if !domains.is_empty() {
                bail!("--domain is not valid with --level tool-freeze");
            }
            Ok(security::EstopLevel::ToolFreeze(tools))
        }
    }
}

View on GitHub (pinned to 88bb9c8533)