{"record":{"id":"310dc5c23ceb545a","repo":"tinyhumansai/openhuman","slug":"memory-chunk-context-source-query-failed-e","errorCode":null,"errorMessage":"memory_chunk_context: source query failed: {e}","messagePattern":"memory_chunk_context: source query failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/openhuman/memory/tools/search/chunk_context.rs","lineNumber":119,"sourceCode":"        if !tinymemory_core::source_scope::chunk_source_allowed(&target.metadata.tags, &source_id) {\n            return Ok(ToolResult::success(\n                \"Chunk is from a memory source not available to the active agent profile.\",\n            ));\n        }\n\n        // Get all chunks from the same source, ordered by timestamp. The\n        // source-scope gate also applies here (the target was already checked\n        // above; this keeps the window consistent). None = unrestricted.\n        let source_query = ChunkQuery {\n            source_kind: Some(source_kind),\n            source_id: Some(source_id.clone()),\n            limit: Some(500),\n            ..Default::default()\n        };\n        let mut source_chunks = chunk_reader\n            .list_chunks(&source_query, None)\n            .await\n            .map_err(|e| anyhow::anyhow!(\"memory_chunk_context: source query failed: {e}\"))?;\n\n        // Sort by seq_in_source (ascending) for natural reading order\n        source_chunks.sort_by_key(|c| c.seq_in_source);\n\n        // Find the target's position\n        let target_pos = source_chunks\n            .iter()\n            .position(|c| c.id == parsed.chunk_id)\n            .ok_or_else(|| anyhow::anyhow!(\n                \"memory_chunk_context: target chunk not found in source (source may have >500 chunks)\"\n            ))?;\n\n        // Compute window bounds\n        let start = target_pos.saturating_sub(window);\n        let end = (target_pos + window + 1).min(source_chunks.len());\n        let window_chunks = &source_chunks[start..end];\n\n        let mut output = format!(","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/memory/tools/search/chunk_context.rs#L101-L137","documentation":"Error-surfacing wrapper in the memory_chunk_context tool's execute: the window query — all chunks of the same source ordered by timestamp, used to assemble neighbors around the already-validated target chunk — failed on the driver. The target chunk itself passed the source-scope check; this is the follow-up list query failing (driver/transport error), so no context window was returned.","triggerScenarios":"Thrown at src/openhuman/memory/tools/search/chunk_context.rs:119 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry transient listing failures","Check the source still exists and is enabled","Inspect the chained driver error"],"exampleFix":null,"handlingStrategy":"retry","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"}