HKUDS/Vibe-Trading · error · RegistryError
{alpha_id}: cannot stat source: {exc}
Error message
{alpha_id}: cannot stat source: {exc} What it means
get_source stats the recorded .py file before reading and wraps any OSError (file deleted, permission denied, path on an unmounted drive) into a RegistryError. The original OSError is chained as __cause__. It means the path was recorded but is no longer accessible at stat time.
Source
Thrown at agent/src/factors/registry.py:302
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": [
{"alpha_id": e.alpha_id, "reason": e.reason} for e in self._load_errors
],
}
View on GitHub (pinned to 80ffdda44c)
Solutions
- Verify the file exists at the path shown in the message
- Restore or re-scan the registry so paths point at existing files
- Fix permissions/ownership on the source tree
Defensive patterns
Strategy: try-catch
Validate before calling
import os
p = registry._py_paths.get(alpha_id)
if p and not os.path.exists(p):
raise FileNotFoundError(p) Try / catch
try:
src = registry.get_source(aid)
except RegistryError as e:
if 'cannot stat' in str(e):
registry.reload(); src = registry.get_source(aid)
else: raise Prevention
- Don't delete/move zoo files while registry is live
- Re-scan registry after repo changes
When it happens
Trigger: get_source(alpha_id) after the source file was deleted, renamed, or made unreadable (permissions/ownership), or when the recorded path points to a network mount that is down.
Common situations: Cleanup jobs or re-cloning the repo after registry load; container environments where files are copied between registration and read; restrictive file permissions.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- {alpha_id}: cannot read source: {exc}
- unknown sort {v!r}; expected one of {sorted(_VALID_SORTS)}
- unknown zoo {zoo!r}; expected one of {sorted(_VALID_ZOOS)}
- Media file not found: {media_path}
- VIBE_TRADING_HOME must not be a UNC path: {env_root!r}
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/970f06ad7f96377e.
Report an issue: GitHub.