microsoft/autogen · error · ValueError
Non-sequential queries cannot be run with an underlying sequ
Error message
Non-sequential queries cannot be run with an underlying sequential RedisMemory. Set sequential=False in RedisMemoryConfig to enable semantic memory querying.
What it means
When RedisMemory is configured with sequential=True, it is backed by plain MessageHistory (ordered, no embeddings). Calling query() with sequential=False (per-call override) would require semantic vector search that the underlying store cannot perform, so it raises ValueError telling you to set sequential=False in the config for semantic queries.
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/memory/redis/_redis_memory.py:298
in the RedisMemoryConfig. If a MemoryContent object is passed, the content field
of this object is extracted and a vector embedding is created from it with the
model specified in the RedisMemoryConfig.
cancellation_token (CancellationToken): Token passed to cease operation. Not used.
Returns:
memoryQueryResult: Object containing memories relevant to the provided query.
"""
top_k = kwargs.pop("top_k", self.config.top_k)
distance_threshold = kwargs.pop("distance_threshold", self.config.distance_threshold)
# return empty results for empty/whitespace queries
if isinstance(query, str) and not query.strip():
return MemoryQueryResult(results=[])
# if sequential memory is requested skip prompt creation
sequential = bool(kwargs.pop("sequential", self.config.sequential))
if self.config.sequential and not sequential:
raise ValueError(
"Non-sequential queries cannot be run with an underlying sequential RedisMemory. Set sequential=False in RedisMemoryConfig to enable semantic memory querying."
)
elif sequential or self.config.sequential:
results = self.message_history.get_recent(
top_k=top_k,
raw=False,
)
else:
# get the query string, or raise an error for unsupported MemoryContent types
if isinstance(query, str):
prompt = query
elif isinstance(query, MemoryContent):
if query.mime_type in (MemoryMimeType.TEXT, MemoryMimeType.MARKDOWN):
prompt = str(query.content)
elif query.mime_type == MemoryMimeType.JSON:
prompt = serialize(query.content)
else:
raise NotImplementedError(View on GitHub (pinned to 027ecf0a37)
Solutions
- If you need semantic (vector) queries, construct RedisMemory with RedisMemoryConfig(sequential=False) — note the reverse direction (query sequential=True on a semantic config) IS allowed.
- If chronological recall is what you want, drop the sequential=False kwarg from the query call.
- Use two memory instances (one sequential, one semantic) if both behaviors are needed.
Example fix
# before
config = RedisMemoryConfig(sequential=True)
memory = RedisMemory(config=config)
await memory.query('find notes', sequential=False) # ValueError
# after
config = RedisMemoryConfig(sequential=False)
memory = RedisMemory(config=config)
await memory.query('find notes') # semantic search Defensive patterns
Strategy: validation
Validate before calling
async def semantic_query(memory, text, **kw):
if memory.config.sequential:
raise ValueError('this memory is sequential-only; use a sequential=False config for semantic search')
return await memory.query(text, **kw) Prevention
- Decide sequential vs semantic once at config time, not per call
- Do not pass sequential=False overrides to a sequential-configured memory
- Use separate instances for chronological and semantic recall
When it happens
Trigger: RedisMemoryConfig(sequential=True) then await memory.query(text, sequential=False); passing sequential=False via kwargs at query time; toggling per-call sequential on a sequentially configured memory.
Common situations: Reusing one memory instance for both chronological recall and semantic search; copying per-call overrides from an example that used a semantic config; misunderstanding that sequential mode cannot be downgraded per call (only non-sequential can be upgraded).
Related errors
- Reset not allowed. Set allow_reset=True in config to enable.
- config is required when using local Mem0 client (is_cloud=Fa
- Error: {content.mime_type} is not supported. Only MemoryMime
- Error: {query.mime_type} is not supported. Only MemoryMimeTy
- 'query' must be either a string or MemoryContent
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/cc9d273469f0283e.
Report an issue: GitHub.