HKUDS/Vibe-Trading · error · RegistryError
{alpha_id}: output shape {result.shape} != close shape {ref.
Error message
{alpha_id}: output shape {result.shape} != close shape {ref.shape} What it means
_validate_output compares the result's shape to the panel's 'close' DataFrame; every factor must produce a matrix with identical (rows, cols) so outputs stack across alphas. Mismatched shapes are rejected.
Source
Thrown at agent/src/factors/registry.py:388
spec.loader.exec_module(module)
except Exception:
sys.modules.pop(alpha.module_path, None)
raise
return module
@staticmethod
def _validate_output(
alpha_id: str,
result: Any,
panel: dict[str, pd.DataFrame],
) -> pd.DataFrame:
if not isinstance(result, pd.DataFrame):
raise RegistryError(
f"{alpha_id}: compute() returned {type(result).__name__}, expected DataFrame"
)
ref = panel.get("close")
if ref is not None and result.shape != ref.shape:
raise RegistryError(
f"{alpha_id}: output shape {result.shape} != close shape {ref.shape}"
)
arr = result.to_numpy(dtype=np.float64, na_value=np.nan)
if np.isinf(arr).any():
raise RegistryError(f"{alpha_id}: output contains +/- inf")
nan_ratio = float(np.isnan(arr).mean()) if arr.size > 0 else 1.0
if nan_ratio > 0.95:
raise RegistryError(f"{alpha_id}: output >95% NaN (nan_ratio={nan_ratio:.3f})")
return result
def export_manifest(self) -> dict[str, Any]:
"""Return a JSON-serialisable snapshot for wiki rendering."""
from datetime import datetime, timezone
zoos: dict[str, list[dict[str, Any]]] = {}
for a in self._alphas.values():
zoos.setdefault(a.zoo, []).append(
{View on GitHub (pinned to 80ffdda44c)
Solutions
- Reindex the result to close's index and columns before returning: `result = result.reindex(index=close.index, columns=close.columns)`
- Avoid dropna on axes; use fillna/leave NaNs (up to 95% allowed)
- Compute on full-dimension intermediates
Example fix
# before return df.dropna(axis=1, how='all') # after return df.reindex(index=close.index, columns=close.columns)
Defensive patterns
Strategy: validation
Validate before calling
ref = panel['close'] assert result.shape == ref.shape, (result.shape, ref.shape)
Try / catch
try:
out = registry.compute(aid, panel)
except RegistryError as e:
if 'output shape' in str(e): skip(aid)
else: raise Prevention
- Reindex outputs to close's index/columns before returning
- Never dropna on axes inside factors
When it happens
Trigger: compute returns a subset of columns, a resampled/reindexed frame, or drops NaN rows — anything changing shape relative to panel['close'].
Common situations: Factor drops symbols with missing data (dropna), computes only on filtered tickers, or reindexes dates; panels with duplicated symbols causing shape drift.
Related errors
- {alpha_id}: compute() returned {type(result).__name__}, expe
- unknown universe {v!r}; expected one of {sorted(_BENCH_UNIVE
- ts_max window must be >= 1, got {n}
- ts_min window must be >= 1, got {n}
- {alpha_id}: module has no compute() function
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/a9c6c030cb5ac580.
Report an issue: GitHub.