run-llama/llama_index · error · ValueError
Unexpected kwargs: {kwargs}
Error message
Unexpected kwargs: {kwargs} What it means
Error "Unexpected kwargs: {kwargs}" thrown in run-llama/llama_index.
Source
Thrown at llama-index-core/llama_index/core/memory/simple_composable_memory.py:53
secondary_memory_sources: List[SerializeAsAny[BaseMemory]] = Field(
default_factory=list, description="Secondary memory sources."
)
@classmethod
def class_name(cls) -> str:
"""Class name."""
return "SimpleComposableMemory"
@classmethod
def from_defaults(
cls,
primary_memory: Optional[BaseMemory] = None,
secondary_memory_sources: Optional[List[BaseMemory]] = None,
**kwargs: Any,
) -> "SimpleComposableMemory":
"""Create a simple composable memory from an LLM."""
if kwargs:
raise ValueError(f"Unexpected kwargs: {kwargs}")
primary_memory = primary_memory or ChatMemoryBuffer.from_defaults()
secondary_memory_sources = secondary_memory_sources or []
return cls(
primary_memory=primary_memory,
secondary_memory_sources=secondary_memory_sources,
)
def _format_secondary_messages(
self, secondary_chat_histories: List[List[ChatMessage]]
) -> str:
"""Formats retrieved historical messages into a single string."""
# TODO: use PromptTemplate for this
formatted_history = "\n\n" + DEFAULT_INTRO_HISTORY_MESSAGE + "\n"
for ix, chat_history in enumerate(secondary_chat_histories):
formatted_history += (
f"\n=====Relevant messages from memory source {ix + 1}=====\n\n"View on GitHub (pinned to afd0fef371)
Solutions
- Remove the unexpected keyword arguments from the constructor call.
- Pass only supported arguments such as primary_memory and secondary_memory_sources.
When it happens
Trigger: Thrown at llama-index-core/llama_index/core/memory/simple_composable_memory.py:53 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15).
Data as JSON: /api/errors/5eefa1fb4b3d5afd.
Report an issue: GitHub.