zylon-ai/private-gpt · error · ValueError
Unknown memory type: {type}
Error message
Unknown memory type: {type} What it means
Raised by Memory.from_defaults when the requested memory type string is not a key in the _PROVIDERS registry. Providers register themselves (presumably via a register decorator writing into _PROVIDERS), and from_defaults only accepts registered types — the Literal['trim', 'summary'] in the signature documents the built-ins. The error is a registry miss: unknown, misspelled, or unregistered type.
Source
Thrown at private_gpt/components/memory/memory.py:34
_PROVIDERS: dict[str, MemoryProvider] = {
"trim": _trim_memory,
}
def register_memory(memory_type: str, provider: MemoryProvider) -> None:
_PROVIDERS[memory_type] = provider
class Memory:
@classmethod
def from_defaults(
cls,
type: Literal["trim", "summary"],
**kwargs: Any,
) -> "BaseMemory":
provider = _PROVIDERS.get(type)
if provider is None:
raise ValueError(f"Unknown memory type: {type}")
return provider(**kwargs)
View on GitHub (pinned to 4a030776a3)
Solutions
- Use a registered type string: 'trim' or 'summary' (or your registered custom key).
- Ensure custom providers are registered by importing their module before calling from_defaults.
- Check the _PROVIDERS dict keys to see what is actually registered in your runtime.
- Guard config at load time against the allowed set of memory types.
Example fix
# before memory = Memory.from_defaults(type='trimm', token_limit=2048) # after memory = Memory.from_defaults(type='trim', token_limit=2048)
Defensive patterns
Strategy: validation
Validate before calling
KNOWN_MEMORY_TYPES = {'trim', 'summary'}
if memory_type not in KNOWN_MEMORY_TYPES:
raise ConfigError(f'memory type must be one of {KNOWN_MEMORY_TYPES}') Type guard
def is_known_memory_type(t: str) -> bool:
return t in _PROVIDERS Try / catch
try:
mem = Memory.from_defaults(type=memory_type, **kw)
except ValueError:
mem = Memory.from_defaults(type='trim', **kw) Prevention
- Restrict the memory-type setting with an enum/Literal at the config layer.
- Import custom memory provider modules before any from_defaults call so registration happens.
When it happens
Trigger: Memory.from_defaults(type='trimm') (typo); type='summarize' instead of 'summary'; a custom memory provider whose registration code never ran (module not imported, entry point missing); passing a provider class instead of the string key.
Common situations: Typos in memory config; renaming of memory types across versions; custom memory modules not imported before from_defaults is called.
Related errors
- LLM mode '{mode}' is not supported. Available: {available}
- Model '{target_model}' not found. Available: {available}
- Token limit must be set and greater than 0.
- start_on can only be used with 'last' strategy
- include_system can only be used with 'last' strategy
AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15).
Data as JSON: /api/errors/093c72be2f232136.
Report an issue: GitHub.