tinyhumansai/openhuman · error · anyhow::Error

memory_chunk_context: source query failed: {e}

Error message

memory_chunk_context: source query failed: {e}

What it means

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.

Source

Thrown at src/openhuman/memory/tools/search/chunk_context.rs:119

        if !tinymemory_core::source_scope::chunk_source_allowed(&target.metadata.tags, &source_id) {
            return Ok(ToolResult::success(
                "Chunk is from a memory source not available to the active agent profile.",
            ));
        }

        // Get all chunks from the same source, ordered by timestamp. The
        // source-scope gate also applies here (the target was already checked
        // above; this keeps the window consistent). None = unrestricted.
        let source_query = ChunkQuery {
            source_kind: Some(source_kind),
            source_id: Some(source_id.clone()),
            limit: Some(500),
            ..Default::default()
        };
        let mut source_chunks = chunk_reader
            .list_chunks(&source_query, None)
            .await
            .map_err(|e| anyhow::anyhow!("memory_chunk_context: source query failed: {e}"))?;

        // Sort by seq_in_source (ascending) for natural reading order
        source_chunks.sort_by_key(|c| c.seq_in_source);

        // Find the target's position
        let target_pos = source_chunks
            .iter()
            .position(|c| c.id == parsed.chunk_id)
            .ok_or_else(|| anyhow::anyhow!(
                "memory_chunk_context: target chunk not found in source (source may have >500 chunks)"
            ))?;

        // Compute window bounds
        let start = target_pos.saturating_sub(window);
        let end = (target_pos + window + 1).min(source_chunks.len());
        let window_chunks = &source_chunks[start..end];

        let mut output = format!(

View on GitHub (pinned to 7491200858)

Solutions

  1. Retry transient listing failures
  2. Check the source still exists and is enabled
  3. Inspect the chained driver error
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at src/openhuman/memory/tools/search/chunk_context.rs:119 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/310dc5c23ceb545a. Report an issue: GitHub.