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

Unknown action '{action}'. Valid: get, set, disable, list_se

Error message

Unknown action '{action}'. Valid: get, set, disable, list_services, apply_env, clear_env

What it means

proxy_config's execute dispatches on the string in the `action` field; after the known branches (get, set, disable, list_services, apply_env, clear_env) run, any other action string falls to this bail listing the valid names. It is a strict, case-sensitive snake_case match.

Source

Thrown at crates/zeroclaw-tools/src/proxy_config.rs:505

            .to_ascii_lowercase();

        let result = match action.as_str() {
            "get" => self.handle_get(),
            "list_services" => self.handle_list_services(),
            "set" | "disable" | "apply_env" | "clear_env" => {
                if let Some(blocked) = self.require_write_access() {
                    return Ok(blocked);
                }

                match action.as_str() {
                    "set" => Box::pin(self.handle_set(&args)).await,
                    "disable" => Box::pin(self.handle_disable(&args)).await,
                    "apply_env" => self.handle_apply_env(),
                    "clear_env" => self.handle_clear_env(),
                    _ => unreachable!("handled above"),
                }
            }
            _ => anyhow::bail!(
                "Unknown action '{action}'. Valid: get, set, disable, list_services, apply_env, clear_env"
            ),
        };

        match result {
            Ok(outcome) => Ok(outcome),
            Err(error) => Ok(ToolResult {
                success: false,
                output: ToolOutput::default(),
                error: Some(error.to_string()),
            }),
        }
    }
}

#[cfg(test)]
mod tests {
    use super::*;

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Use exactly one of: get, set, disable, list_services, apply_env, clear_env (lowercase, underscores)
  2. Print the tool's parameter schema (description lists valid actions) when unsure
  3. Guard dynamic callers with an allowlist constant so invalid names fail at compile time, not at runtime

Example fix

// before
{"action":"apply-env"}
// after
{"action":"apply_env"}
Defensive patterns

Strategy: validation

Validate before calling

const PROXY_ACTIONS: &[&str] = &["get","set","disable","list_services","apply_env","clear_env"];
if !PROXY_ACTIONS.contains(&action.as_str()) {
    return Err(anyhow::anyhow!("invalid proxy action {action}"));
}

Type guard

fn is_known_proxy_action(a: &str) -> bool {
    ["get","set","disable","list_services","apply_env","clear_env"].contains(&a)
}

Try / catch

Err(e) if e.to_string().starts_with("Unknown action") => {
    // log the rejected action plus the valid list; fail the user request with both
}

Prevention

When it happens

Trigger: Typos and casing variants such as "getList", "apply-env", "services", "enable", or "set_env"; also programmatic callers building the action string dynamically with a wrong constant.

Common situations: LLM-driven tool invocation inventing plausible action names; scripts written against an older/newer version of the tool where the action set differs; copy-paste from docs of a different tool (e.g. jira or cloud_patterns actions).

Related errors


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