run-llama/llama_index · warning · ValueError
Could not parse output: {output}
Error message
Could not parse output: {output} What it means
Async counterpart: BaseKeyValueStore.aput_all's default implementation rejects any batch_size != 1 with NotImplementedError, then falls back to awaiting aput per pair. Stores that never override aput_all (minimal custom stores, some integrations) cannot batch async writes.
Source
Thrown at llama-index-core/llama_index/core/agent/react/output_parser.py:123
)
# An "Action" should take priority over an "Answer"
if (
action_idx is not None
and answer_idx is not None
and action_idx < answer_idx
):
return parse_action_reasoning_step(output)
elif action_idx is not None and answer_idx is None:
return parse_action_reasoning_step(output)
if answer_idx is not None:
thought, answer = extract_final_response(output)
return ResponseReasoningStep(
thought=thought, response=answer, is_streaming=is_streaming
)
raise ValueError(f"Could not parse output: {output}")
def format(self, output: str) -> str:
"""Format a query with structured output formatting instructions."""
raise NotImplementedError
View on GitHub (pinned to afd0fef371)
Solutions
- Drop the batch_size argument (use default 1) when calling aput_all on stores without batching support.
- Override aput_all in your custom store to loop or bulk-insert: async for key, val: await self.aput(...).
- Use built-in stores with native async batching (e.g. RedisKVStore, MongoDBKVStore) for high-throughput async ingestion.
- Guard with hasattr/inspect to detect stores lacking an aput_all override before requesting batches.
Example fix
# before
await kvstore.aput_all(pairs, batch_size=100) # NotImplementedError
# after
class MyKVStore(BaseKeyValueStore):
async def aput_all(self, kv_pairs, collection=DEFAULT_COLLECTION, batch_size=1):
for key, val in kv_pairs:
await self.aput(key, val, collection=collection)
await kvstore.aput_all(pairs) Defensive patterns
Strategy: validation
Validate before calling
from llama_index.core.storage.kvstore.types import BaseKeyValueStore
if batch_size != 1 and type(kvstore).aput_all is BaseKeyValueStore.aput_all:
await kvstore.aput_all(kv_pairs)
else:
await kvstore.aput_all(kv_pairs, batch_size=batch_size) Type guard
def supports_async_batching(store) -> bool:
return type(store).aput_all is not BaseKeyValueStore.aput_all Try / catch
try:
await kvstore.aput_all(pairs, batch_size=32)
except NotImplementedError:
await kvstore.aput_all(pairs) Prevention
- Override aput_all in custom async stores.
- Default to batch_size=1 unless the store class is known to batch.
- Use built-in DB-backed stores for bulk async ingestion.
When it happens
Trigger: Awaiting kvstore.aput_all(kv_pairs, batch_size=32) on a custom KV store that only implements aput/aget/adelete; async ingestion pipelines that pass a configured batch size down to the storage layer.
Common situations: Custom async KVStore subclasses used under AsyncSimpleDocumentStore or async index stores; test doubles / in-memory fakes implementing only the abstract methods; porting sync stores to async without porting the batching override.
Related errors
- Could not extract final answer from input text: {input_text}
- 'handoff' is a reserved tool name. Please use a different na
- Got empty streaming response
- astream_complete is not supported by default.
- astream_call is not supported by default.
AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15).
Data as JSON: /api/errors/dc3f4f0dca277355.
Report an issue: GitHub.