HKUDS/Vibe-Trading · error · RegistryError
{alpha_id}: no source path recorded
Error message
{alpha_id}: no source path recorded What it means
Raised by FactorRegistry.get_source when the alpha_id exists in the registry but no Python source path was recorded for it. The registry stores a mapping of alpha ids to .py file paths; if that entry is missing, the source cannot be retrieved. It usually indicates the alpha was registered without filesystem-backed source discovery.
Source
Thrown at agent/src/factors/registry.py:298
return sorted(out)
def get(self, alpha_id: str) -> Alpha:
if alpha_id not in self._alphas:
raise KeyError(f"alpha_id {alpha_id!r} not in registry")
return self._alphas[alpha_id]
def get_source(self, alpha_id: str) -> str:
"""Return the raw .py source of a registered alpha (size-capped).
Raises:
KeyError: alpha_id unknown.
RegistryError: source file exceeds ``_MAX_PY_BYTES`` or cannot be read.
"""
if alpha_id not in self._alphas:
raise KeyError(f"alpha_id {alpha_id!r} not in registry")
py_path = self._py_paths.get(alpha_id)
if py_path is None:
raise RegistryError(f"{alpha_id}: no source path recorded")
try:
size = py_path.stat().st_size
except OSError as exc:
raise RegistryError(f"{alpha_id}: cannot stat source: {exc}") from exc
if size > _MAX_PY_BYTES:
raise RegistryError(
f"{alpha_id}: source {size}B exceeds {_MAX_PY_BYTES}B cap"
)
try:
return py_path.read_text(encoding="utf-8")
except OSError as exc:
raise RegistryError(f"{alpha_id}: cannot read source: {exc}") from exc
def health(self) -> dict[str, Any]:
return {
"loaded": len(self._alphas),
"failed": len(self._load_errors),
"errors": [View on GitHub (pinned to 80ffdda44c)
Solutions
- Check registry.health() to confirm the alpha loaded and inspect how it was registered
- Ensure the registry is constructed with filesystem source discovery enabled so _py_paths is populated
- Rebuild/reload the registry from the zoo directory before calling get_source
Example fix
// before
src = registry.get_source('alpha_008')
// after
if registry.has_source('alpha_008'):
src = registry.get_source('alpha_008')
else:
src = inspect.getsource(importlib.import_module(module_path)) Defensive patterns
Strategy: validation
Validate before calling
py_path = registry._py_paths.get(alpha_id) if hasattr(registry, '_py_paths') else None
if py_path is None:
logger.warning('no source recorded; falling back to inspect') Try / catch
try:
src = registry.get_source(alpha_id)
except RegistryError:
src = inspect.getsource(importlib.import_module(registry.get(alpha_id).module_path)) Prevention
- Build the registry with filesystem source discovery enabled
- Call health() after loading to verify registry state
When it happens
Trigger: Calling get_source(alpha_id) or get_alpha(alpha_id, include_source=True) for an alpha registered from an installed package (no _py_paths entry), or after a partial registry load that skipped source-path collection.
Common situations: Registry built with filesystem loader disabled; alpha registered programmatically rather than scanned from disk; source files moved/deleted between registration and lookup.
Related errors
- {alpha_id}: source {size}B exceeds {_MAX_PY_BYTES}B cap
- unknown panel column: {column}
- invalid {kind} {token!r}: must match {_ID_RE.pattern}
- {path.name}: {size}B exceeds {_MAX_PY_BYTES}B cap
- {path.name}: __alpha_meta__ assignment not found
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/308e00d15e16b77e.
Report an issue: GitHub.