tinyhumansai/openhuman · error · anyhow::Error

too many tool_names ({}); max {MAX_PREAUTHORIZE_TOOLS}

Error message

too many tool_names ({}); max {MAX_PREAUTHORIZE_TOOLS}

What it means

Bounds guard in approval_preauthorize_flow: the tool_names vector exceeds MAX_PREAUTHORIZE_TOOLS, the compiled cap on how many tools a single flow may pre-authorize in one call. This keeps the consolidated pre-auth card and the born-decided audit rows bounded; the faulting input is an oversized tool list from the caller.

Source

Thrown at src/openhuman/security/approval/rpc.rs:120

///
/// Unlike `approval_decide`, a missing gate is NOT an error: with the gate
/// uninstalled (`OPENHUMAN_APPROVAL_GATE=0`) nothing ever parks, so there is
/// nothing to pre-authorize — the call reports `gate_installed: false` and
/// succeeds, keeping the save-and-enable UX identical in both modes.
pub async fn approval_preauthorize_flow(
    flow_id: &str,
    tool_names: Vec<String>,
) -> anyhow::Result<RpcOutcome<FlowPreauthorizationResult>> {
    tracing::debug!(
        flow_id = flow_id,
        tools = tool_names.len(),
        "[rpc:approval_preauthorize_flow] entry"
    );
    if flow_id.trim().is_empty() {
        return Err(anyhow!("flow_id must not be empty"));
    }
    if tool_names.len() > MAX_PREAUTHORIZE_TOOLS {
        return Err(anyhow!(
            "too many tool_names ({}); max {MAX_PREAUTHORIZE_TOOLS}",
            tool_names.len()
        ));
    }
    let Some(gate) = ApprovalGate::try_global() else {
        tracing::info!(
            flow_id = flow_id,
            "[rpc:approval_preauthorize_flow] gate not installed; nothing to grant"
        );
        return Ok(RpcOutcome::single_log(
            FlowPreauthorizationResult {
                flow_id: flow_id.to_string(),
                granted: vec![],
                already_trusted: vec![],
                gate_installed: false,
            },
            "[approval] preauthorize: gate not installed, no trust persisted".to_string(),
        ));

View on GitHub (pinned to 7491200858)

Solutions

  1. Reduce the number of tools pre-authorized per call, splitting across multiple calls if needed.
  2. Review the flow for accidentally duplicated tool entries.
  3. Raise MAX_PREAUTHORIZE_TOOLS deliberately if the product legitimately needs a higher cap.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/security/approval/rpc.rs:120 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/2b25ea09c8759991. Report an issue: GitHub.