zylon-ai/private-gpt · error · ValueError
Unknown condense strategy: {strategy}
Error message
Unknown condense strategy: {strategy} What it means
ValueError from get_condense_memory_strategy (base_strategy.py). The factory resolves the strategy string to a CondenseStrategyType enum (via from_string) or accepts an enum directly, then looks it up in _PROVIDERS; only strategies registered through register_condense_strategy exist (built-in example: "condenser"). An unresolvable name yields this error.
Source
Thrown at private_gpt/components/chat/processors/chat_history/memory/strategies/base_strategy.py:104
) -> BaseMemoryStrategy:
"""Get the condense strategy from a string or CondenseStrategy enum.
Args:
strategy (str | CondenseStrategy): The strategy to get.
injector (Injector | None): Optional dependency injector for workflow builders.
**kwargs: Additional keyword arguments to pass to the strategy constructor.
Returns:
CondenseStrategy: The corresponding CondenseStrategy enum.
"""
strategy_enum = (
strategy
if isinstance(strategy, CondenseStrategyType)
else CondenseStrategyType.from_string(strategy)
)
provider = _PROVIDERS.get(strategy_enum)
if provider is None:
raise ValueError(f"Unknown condense strategy: {strategy}")
return provider(injector=injector, **kwargs)
View on GitHub (pinned to 4a030776a3)
Solutions
- Use a registered strategy name — check _PROVIDERS / the CondenseStrategyType enum for valid values (e.g. "condenser").
- For custom strategies, call register_condense_strategy(...) with the name before get_condense_memory_strategy runs.
- Fix casing/typos in the configured string; from_string matching is exact after normalization.
- If a strategy disappeared after upgrade, check the changelog for its renamed replacement.
Example fix
// before
memory:
condense:
strategy: summary # ValueError: Unknown condense strategy
// after
memory:
condense:
strategy: condenser Defensive patterns
Strategy: validation
Validate before calling
from private_gpt.components.chat.processors.chat_history.memory.strategies.base_strategy import _PROVIDERS
if strategy_name not in {s.value for s in _PROVIDERS}:
raise ValueError(f"strategy must be one of {sorted(s.value for s in _PROVIDERS)}, got {strategy_name!r}") Type guard
def is_known_strategy(name: str) -> bool:
from ...base_strategy import _PROVIDERS
from ...base_strategy import CondenseStrategyType
try:
CondenseStrategyType.from_string(name)
return True
except Exception:
return False Try / catch
try:
strategy = get_condense_memory_strategy(name, injector)
except ValueError as e:
raise ValueError(f"Bad condense config: {e}. Available: condenser") from e Prevention
- Validate strategy names against the enum at settings-load time.
- Register custom strategies before config resolution runs.
- Add a settings schema test enumerating valid strategies.
- Check changelogs for renamed strategies after upgrades.
When it happens
Trigger: Configuring condense strategy settings with a typo or unregistered name (e.g. "summary", "rolling", "Condenser"); passing a custom strategy string without first calling register_condense_strategy; version drift where a renamed strategy no longer exists.
Common situations: settings.yaml condense blocks copied from other projects; upgrading private-gpt and strategy names changed; custom plugins whose registration runs after settings parsing.
Related errors
- Unknown memory type: {type}
- 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
- Invalid system item in list: {item}
AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15).
Data as JSON: /api/errors/8659c37980aa6fa6.
Report an issue: GitHub.