{"record":{"id":"2b25ea09c8759991","repo":"tinyhumansai/openhuman","slug":"too-many-tool-names-max-max-preauthorize-to","errorCode":null,"errorMessage":"too many tool_names ({}); max {MAX_PREAUTHORIZE_TOOLS}","messagePattern":"too many tool_names \\((.+?)\\); max (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/openhuman/security/approval/rpc.rs","lineNumber":120,"sourceCode":"///\n/// Unlike `approval_decide`, a missing gate is NOT an error: with the gate\n/// uninstalled (`OPENHUMAN_APPROVAL_GATE=0`) nothing ever parks, so there is\n/// nothing to pre-authorize — the call reports `gate_installed: false` and\n/// succeeds, keeping the save-and-enable UX identical in both modes.\npub async fn approval_preauthorize_flow(\n    flow_id: &str,\n    tool_names: Vec<String>,\n) -> anyhow::Result<RpcOutcome<FlowPreauthorizationResult>> {\n    tracing::debug!(\n        flow_id = flow_id,\n        tools = tool_names.len(),\n        \"[rpc:approval_preauthorize_flow] entry\"\n    );\n    if flow_id.trim().is_empty() {\n        return Err(anyhow!(\"flow_id must not be empty\"));\n    }\n    if tool_names.len() > MAX_PREAUTHORIZE_TOOLS {\n        return Err(anyhow!(\n            \"too many tool_names ({}); max {MAX_PREAUTHORIZE_TOOLS}\",\n            tool_names.len()\n        ));\n    }\n    let Some(gate) = ApprovalGate::try_global() else {\n        tracing::info!(\n            flow_id = flow_id,\n            \"[rpc:approval_preauthorize_flow] gate not installed; nothing to grant\"\n        );\n        return Ok(RpcOutcome::single_log(\n            FlowPreauthorizationResult {\n                flow_id: flow_id.to_string(),\n                granted: vec![],\n                already_trusted: vec![],\n                gate_installed: false,\n            },\n            \"[approval] preauthorize: gate not installed, no trust persisted\".to_string(),\n        ));","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/security/approval/rpc.rs#L102-L138","documentation":"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.","triggerScenarios":"Thrown at src/openhuman/security/approval/rpc.rs:120 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce the number of tools pre-authorized per call, splitting across multiple calls if needed.","Review the flow for accidentally duplicated tool entries.","Raise MAX_PREAUTHORIZE_TOOLS deliberately if the product legitimately needs a higher cap."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}