zeroclaw-labs/zeroclaw · error

{entry_path} includes and excludes the same argument '{field

Error message

{entry_path} includes and excludes the same argument '{field}'

What it means

In a `stream_tool_arguments` tool rule, `include` adds argument fields after the `base` set is chosen and `exclude` removes fields from it. An argument appearing in both lists is contradictory (add and remove the same field), so the validator rejects the overlap to make the intended rendered set unambiguous.

Source

Thrown at crates/zeroclaw-config/src/schema.rs:15551

                    exclude,
                    ..
                } => {
                    if tool.is_empty() || tool.trim() != tool {
                        anyhow::bail!(
                            "{entry_path}.tool must be a non-empty exact tool name without surrounding whitespace"
                        );
                    }
                    if !tools.insert(tool.as_str()) {
                        anyhow::bail!("{entry_path}.tool duplicates the rule for tool '{tool}'");
                    }

                    let included =
                        validate_stream_tool_argument_names(&entry_path, "include", include)?;
                    let excluded =
                        validate_stream_tool_argument_names(&entry_path, "exclude", exclude)?;
                    for field in &excluded {
                        if included.contains(*field) {
                            anyhow::bail!(
                                "{entry_path} includes and excludes the same argument '{field}'"
                            );
                        }
                    }
                }
            }
        }

        Ok(())
    }
}

impl ChannelConfig for MatrixConfig {
    fn name() -> &'static str {
        "Matrix"
    }
    fn desc() -> &'static str {
        "self-hosted chat"

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Decide whether the field should be shown, then remove it from the other list.
  2. If the intent is 'everything except X', drop the `include` entry and keep `base = "all"` plus `exclude = ["X"]`.
  3. If the intent is 'base plus X', remove X from `exclude`.

Example fix

# before
{ tool = "mock_tool", base = "all", include = ["token"], exclude = ["token"] }

# after
{ tool = "mock_tool", base = "all", exclude = ["token"] }
Defensive patterns

Strategy: validation

Validate before calling

if let StreamToolArgumentEntry::Tool { include, exclude, .. } = entry {
    let overlap: Vec<_> = include.iter().filter(|f| exclude.contains(f)).collect();
    if !overlap.is_empty() {
        anyhow::bail!("fields both included and excluded: {overlap:?}");
    }
}

Prevention

When it happens

Trigger: A rule like `{ tool = "mock_tool", base = "all", include = ["token"], exclude = ["token"] }`; merging an include list and an exclude list that were authored separately and happen to share a field name.

Common situations: Copy-pasting field names between the include and exclude arrays while iterating on redaction policy; intending `base = "all"` minus a field but also adding the field to include by habit; typos that duplicate a field across both lists.

Related errors


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