{"record":{"id":"4e4c753c94d04f4b","repo":"tinyhumansai/openhuman","slug":"apify-run-returned-an-empty-items-array","errorCode":null,"errorMessage":"Apify run returned an empty items array","messagePattern":"Apify run returned an empty items array","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/agent/learning/linkedin_enrichment.rs","lineNumber":671,"sourceCode":"    let status = resp\n        .get(\"status\")\n        .and_then(|v| v.as_str())\n        .unwrap_or(\"UNKNOWN\");\n\n    if status != \"SUCCEEDED\" {\n        anyhow::bail!(\"Apify run finished with status: {status}\");\n    }\n\n    // Extract the first item from the inline results array.\n    let items = resp\n        .get(\"items\")\n        .and_then(|v| v.as_array())\n        .ok_or_else(|| anyhow::anyhow!(\"Apify run returned no items array\"))?;\n\n    items\n        .first()\n        .cloned()\n        .ok_or_else(|| anyhow::anyhow!(\"Apify run returned an empty items array\"))\n}\n\n/// Build a local memory client for profile persistence.\nfn build_memory_client() -> anyhow::Result<tinymemory_core::store::MemoryClient> {\n    tinymemory_core::store::MemoryClient::new_local()\n        .map_err(|e| anyhow::anyhow!(\"memory client unavailable: {e}\"))\n}\n\n/// Persist the full scraped LinkedIn profile to the user-profile memory\n/// namespace so the agent has rich context about the user.\nasync fn persist_linkedin_profile(\n    memory: &tinymemory_core::store::MemoryClient,\n    url: &str,\n    data: &serde_json::Value,\n) -> anyhow::Result<()> {\n    let content = format!(\n        \"LinkedIn profile for {url}:\\n\\n{}\",\n        serde_json::to_string_pretty(data).unwrap_or_else(|_| data.to_string())","sourceCodeStart":653,"sourceCodeEnd":689,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/agent/learning/linkedin_enrichment.rs#L653-L689","documentation":"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.","triggerScenarios":"Thrown at src/openhuman/agent/learning/linkedin_enrichment.rs:671 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm the LinkedIn profile URL is public and correct, then retry","Treat empty results as a soft failure and continue the pipeline without scrape data","Check the actor's output/logs on Apify for why zero items were returned"],"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-23T08:17:48.524Z"}