HKUDS/Vibe-Trading · error · RegistryError
{alpha_id}: compute() raised: {exc}
Error message
{alpha_id}: compute() raised: {exc} What it means
The alpha's compute() itself raised an exception; the registry catches it (isolating factor failures) and re-raises as RegistryError with the original chained. The message embeds the inner exception text; __cause__ preserves the full traceback.
Source
Thrown at agent/src/factors/registry.py:353
missing_extra = [c for c in meta.get("extras_required", []) if c not in panel]
if missing_extra:
raise SkipAlpha(f"{alpha_id}: panel missing extras {missing_extra}")
if meta.get("requires_sector") and "sector" not in panel:
raise SkipAlpha(f"{alpha_id}: panel missing sector tag")
try:
module = self._load_module(alpha)
except Exception as exc: # noqa: BLE001 — isolate import failure
raise RegistryError(f"{alpha_id}: import failed: {exc}") from exc
compute_fn = getattr(module, "compute", None)
if compute_fn is None:
raise RegistryError(f"{alpha_id}: module has no compute() function")
try:
result = compute_fn(panel)
except Exception as exc: # noqa: BLE001 — isolate compute failure
raise RegistryError(f"{alpha_id}: compute() raised: {exc}") from exc
return self._validate_output(alpha_id, result, panel)
def _load_module(self, alpha: Alpha) -> ModuleType:
if not self._use_filesystem_loader:
return importlib.import_module(alpha.module_path)
py_file = self._py_paths[alpha.id]
cached = sys.modules.get(alpha.module_path)
if cached is not None and getattr(cached, "__file__", None) == str(py_file):
return cached
spec = importlib.util.spec_from_file_location(alpha.module_path, py_file)
if spec is None or spec.loader is None:
raise RegistryError(f"{alpha.id}: could not build import spec for {py_file}")
module = importlib.util.module_from_spec(spec)
sys.modules[alpha.module_path] = module
try:
spec.loader.exec_module(module)
except Exception:View on GitHub (pinned to 80ffdda44c)
Solutions
- Debug with exc.__cause__ traceback and reproduce by calling module.compute(panel) directly
- Fix panel alignment/dtypes or the factor formula accordingly
- Skip failing alphas in batch runs (catch RegistryError per alpha)
Example fix
# before
out = registry.compute(alpha_id, panel) # compute() raised
# after
import traceback
try:
out = registry.compute(alpha_id, panel)
except RegistryError as e:
traceback.print_exception(e.__cause__) Defensive patterns
Strategy: try-catch
Try / catch
try:
out = registry.compute(aid, panel)
except RegistryError as e:
if 'compute() raised' in str(e):
log(aid, repr(e.__cause__)); continue
raise Prevention
- Test factors on a known-good golden panel
- Catch RegistryError per alpha in batch loops to isolate failures
When it happens
Trigger: compute(alpha_id, panel) where the factor code hits KeyError on an unexpected panel layout, pandas errors (misaligned indexes, dtype issues), division producing object dtype, etc.
Common situations: Panel index/columns not aligned with expectations; NaN-only inputs triggering pandas edge cases; dtype problems (strings in numeric columns); lookalike data bugs in the factor formula.
Related errors
- ts_max window must be >= 1, got {n}
- ts_min window must be >= 1, got {n}
- unknown panel column: {column}
- invalid {kind} {token!r}: must match {_ID_RE.pattern}
- {path.name}: {size}B exceeds {_MAX_PY_BYTES}B cap
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/6d5c1d9ddcae41b9.
Report an issue: GitHub.