{"record":{"id":"b35a3eb1f4c96fbc","repo":"tinyhumansai/openhuman","slug":"gmail-fetch-emails-direct-failed-e","errorCode":null,"errorMessage":"GMAIL_FETCH_EMAILS (direct) failed: {e:#}","messagePattern":"GMAIL_FETCH_EMAILS \\(direct\\) failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/openhuman/agent/learning/linkedin_enrichment.rs","lineNumber":549,"sourceCode":"    });\n    let resp = match &client_kind {\n        ComposioClientKind::Backend(client) => client\n            .execute_tool(\"GMAIL_FETCH_EMAILS\", Some(args))\n            .await\n            .map_err(|e| anyhow::anyhow!(\"GMAIL_FETCH_EMAILS failed: {e:#}\"))?,\n        ComposioClientKind::Direct(direct) => {\n            tracing::debug!(\n                \"[linkedin_enrichment][composio-direct] GMAIL_FETCH_EMAILS via direct tenant\"\n            );\n            direct_execute(\n                direct,\n                \"GMAIL_FETCH_EMAILS\",\n                Some(args),\n                &config.composio.entity_id,\n                None,\n            )\n            .await\n            .map_err(|e| anyhow::anyhow!(\"GMAIL_FETCH_EMAILS (direct) failed: {e:#}\"))?\n        }\n    };\n\n    if !resp.successful {\n        let err = resp.error.unwrap_or_else(|| \"unknown error\".into());\n        anyhow::bail!(\"GMAIL_FETCH_EMAILS error: {err}\");\n    }\n\n    // Walk the messages, decode HTML parts, and search for profile URLs.\n    let messages = resp\n        .data\n        .get(\"messages\")\n        .and_then(|v| v.as_array())\n        .cloned()\n        .unwrap_or_default();\n\n    for msg in &messages {\n        // Collect all text to search: plain messageText + decoded HTML parts.","sourceCodeStart":531,"sourceCodeEnd":567,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/agent/learning/linkedin_enrichment.rs#L531-L567","documentation":"The same GMAIL_FETCH_EMAILS search executed through the direct-tenant Composio client (user with a stored API key, no backend proxy) failed. Direct-mode calls hit Composio directly, so this usually means an expired/invalid API key, an unconnected Gmail app, or a Composio-side error.","triggerScenarios":"Thrown at src/openhuman/agent/learning/linkedin_enrichment.rs:549 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Refresh the stored Composio API key and confirm the Gmail app is connected for that direct tenant","Retry after re-establishing the direct connection on app.composio.dev","Fall back to backend mode or skip the Gmail stage if direct mode keeps failing"],"exampleFix":null,"handlingStrategy":"try-catch","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-23T08:17:48.524Z"}