calesthio/OpenMontage · error · KeyError
No stock source registered with name={name!r}
Error message
No stock source registered with name={name!r} What it means
KeyError raised by tools/video/stock_sources.get_source(name) when no registered adapter's .name attribute equals the requested name. The registry is built from all_sources(), which imports the adapter modules — so a typo, a disabled/failed import, or a name that was renamed yields this error rather than None (fail-fast lookup by contract).
Source
Thrown at tools/video/stock_sources/__init__.py:139
return {
"configured": len(available),
"total": len(catalog),
"available_source_names": available,
"unavailable_source_names": unavailable,
}
def get_source(name: str) -> StockSource:
"""Look up a single adapter by its `name` attribute.
Raises `KeyError` if no registered adapter claims that name. Useful
for tests and for agents that want to pin to a specific source
(e.g. "only Archive.org for this topic").
"""
for s in all_sources():
if s.name == name:
return s
raise KeyError(f"No stock source registered with name={name!r}")
View on GitHub (pinned to 95e1c3d0ab)
Solutions
- List valid names first: [s.name for s in all_sources()] and use one of those exactly.
- Check for import errors in the adapter modules — a silently failed import removes the source from the registry.
- If the name lives in user config, validate it at config-load time against all_sources().
Example fix
# before
source = get_source("archive")
# after
from tools.video.stock_sources import all_sources
valid = {s.name for s in all_sources()}
source = get_source(name if name in valid else "archive_org") Defensive patterns
Strategy: validation
Validate before calling
from tools.video.stock_sources import all_sources
valid_names = {s.name for s in all_sources()}
if name not in valid_names:
raise ConfigError(f"unknown stock source {name!r}; valid: {sorted(valid_names)}") Type guard
def is_registered_source(name: str) -> bool:
from tools.video.stock_sources import all_sources
return any(s.name == name for s in all_sources()) Try / catch
try:
source = get_source(name)
except KeyError:
source = get_source("archive_org") # deterministic fallback Prevention
- Validate configured source names against all_sources() at startup.
- Watch for import failures in adapter modules that silently shrink the registry.
When it happens
Trigger: Calling get_source('archive') instead of 'archive_org', using an old name after an adapter rename, or referencing an adapter whose module failed to import at package load (e.g. missing optional dependency like beautifulsoup4 suppressing registration).
Common situations: Hardcoded source names in user config or agent prompts drifting from actual adapter names; forks that removed an adapter but kept config referencing it.
Related errors
- Playbook not found: {path}
- Cost entry {entry_id!r} not found
- Unsupported MiniMax image model '{model}'.
- Unsupported Atlas video model id {model!r}. Use get_info()['
- model_variant must be 2.5, standard, fast, or mini
AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15).
Data as JSON: /api/errors/7ab04583655a9486.
Report an issue: GitHub.