tinyhumansai/openhuman · error · anyhow::Error

composio client unavailable

Error message

composio client unavailable: {e}

What it means

The mode-aware Composio client factory (backend-proxy vs direct API-key mode) failed while resolving which client kind to build for the Gmail search stage — e.g. neither a backend session nor a stored direct Composio API key is available. The Gmail lookup stage cannot run at all.

Solutions

  1. Sign in (backend mode) or configure a stored Composio API key (direct mode) and retry
  2. Check the composio config block and entity settings for the mode resolution failure
  3. Let the pipeline skip the Gmail stage and continue with the other enrichment stages
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/openhuman/agent/learning/linkedin_enrichment.rs:521 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/89f9b6806e82576a. Report an issue: GitHub.

Appendix: source

Thrown at src/openhuman/agent/learning/linkedin_enrichment.rs:521

/// **HTML body** — which Gmail returns as base64-encoded data inside
/// `payload.parts[].body.data`. We must decode those parts before
/// regex-matching; searching the raw JSON alone misses them.
async fn search_gmail_for_linkedin(config: &Config) -> anyhow::Result<Option<String>> {
    use crate::openhuman::integrations::composio::client::{
        create_composio_client, direct_execute, ComposioClientKind,
    };
    use base64::engine::general_purpose::URL_SAFE_NO_PAD;
    use base64::Engine;

    // Resolve through the mode-aware factory so a direct-mode user
    // with a stored API key can still drive Gmail enrichment from the
    // personal Composio tenant (#1710 Wave 2). Pre-fix this path used
    // `build_composio_client` and returned early for any user without
    // a backend session, silently disabling LinkedIn enrichment for
    // direct-mode users even when their LinkedIn/Gmail connections
    // were healthy on app.composio.dev.
    let client_kind = create_composio_client(config)
        .map_err(|e| anyhow::anyhow!("composio client unavailable: {e}"))?;

    // `comm/in/<username>` — LinkedIn's own notification emails always use
    // this form to refer to the email *recipient's* profile.
    static COMM_RE: LazyLock<Regex> =
        LazyLock::new(|| Regex::new(r"linkedin\.com/comm/in/([a-zA-Z0-9_-]+)").unwrap());

    let args = json!({
        "query": "from:linkedin.com",
        "max_results": 10,
    });
    let resp = match &client_kind {
        ComposioClientKind::Backend(client) => client
            .execute_tool("GMAIL_FETCH_EMAILS", Some(args))
            .await
            .map_err(|e| anyhow::anyhow!("GMAIL_FETCH_EMAILS failed: {e:#}"))?,
        ComposioClientKind::Direct(direct) => {
            tracing::debug!(
                "[linkedin_enrichment][composio-direct] GMAIL_FETCH_EMAILS via direct tenant"

View on GitHub (pinned to 7491200858)