tinyhumansai/openhuman · error

Apify run returned an empty items array

Error message

Apify run returned an empty items array

What it means

The Apify response contained an `items` array but it was empty, so there is no first item to take. The actor succeeded yet scraped zero results — typically a private/nonexistent profile or a blocked scrape.

Solutions

  1. Confirm the LinkedIn profile URL is public and correct, then retry
  2. Treat empty results as a soft failure and continue the pipeline without scrape data
  3. Check the actor's output/logs on Apify for why zero items were returned
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

    let status = resp
        .get("status")
        .and_then(|v| v.as_str())
        .unwrap_or("UNKNOWN");

    if status != "SUCCEEDED" {
        anyhow::bail!("Apify run finished with status: {status}");
    }

    // Extract the first item from the inline results array.
    let items = resp
        .get("items")
        .and_then(|v| v.as_array())
        .ok_or_else(|| anyhow::anyhow!("Apify run returned no items array"))?;

    items
        .first()
        .cloned()
        .ok_or_else(|| anyhow::anyhow!("Apify run returned an empty items array"))
}

/// Build a local memory client for profile persistence.
fn build_memory_client() -> anyhow::Result<tinymemory_core::store::MemoryClient> {
    tinymemory_core::store::MemoryClient::new_local()
        .map_err(|e| anyhow::anyhow!("memory client unavailable: {e}"))
}

/// Persist the full scraped LinkedIn profile to the user-profile memory
/// namespace so the agent has rich context about the user.
async fn persist_linkedin_profile(
    memory: &tinymemory_core::store::MemoryClient,
    url: &str,
    data: &serde_json::Value,
) -> anyhow::Result<()> {
    let content = format!(
        "LinkedIn profile for {url}:\n\n{}",
        serde_json::to_string_pretty(data).unwrap_or_else(|_| data.to_string())

View on GitHub (pinned to 7491200858)