HKUDS/Vibe-Trading · error · RegistryError
{path.name}: {size}B exceeds {_MAX_YAML_BYTES}B YAML cap
Error message
{path.name}: {size}B exceeds {_MAX_YAML_BYTES}B YAML cap What it means
_safe_yaml_load parses YAML config files with a hard 5 MB cap as defence in depth against oversized (potentially malicious) YAML bombs. Files exceeding _MAX_YAML_BYTES raise RegistryError before yaml.safe_load runs.
Source
Thrown at agent/src/factors/registry.py:192
except (ValueError, SyntaxError) as exc:
raise RegistryError(f"{path.name}: __alpha_meta__ not a literal: {exc}") from exc
if not isinstance(raw, dict):
raise RegistryError(f"{path.name}: __alpha_meta__ must be dict, got {type(raw).__name__}")
try:
return AlphaMeta(**raw)
except ValidationError as exc:
raise RegistryError(f"{path.name}: AlphaMeta validation failed: {exc}") from exc
def _safe_yaml_load(path: Path) -> Any:
"""yaml.safe_load with hard 5 MB size cap (defence in depth)."""
import yaml # local import keeps registry import-light
size = path.stat().st_size
if size > _MAX_YAML_BYTES:
raise RegistryError(f"{path.name}: {size}B exceeds {_MAX_YAML_BYTES}B YAML cap")
text = path.read_text(encoding="utf-8")
return yaml.safe_load(text)
def _zoo_dir_default() -> Path:
return Path(__file__).parent / "zoo"
class Registry:
"""In-memory registry of all discoverable alphas across zoo subdirectories."""
def __init__(self, zoo_root: Path | None = None) -> None:
default_root = _zoo_dir_default()
self._zoo_root = (zoo_root or default_root).resolve()
# When the registry points at the bundled zoo dir, modules are loaded
# by package name (warm import cache, supports relative imports). For
# any other zoo_root (tests, plugins) we load by file path so the
# caller doesn't have to fiddle with sys.path.View on GitHub (pinned to 80ffdda44c)
Solutions
- Split the YAML into multiple smaller files
- Trim stale entries or move bulk data out of config
- Regenerate the config programmatically to remove duplication
Defensive patterns
Strategy: validation
Validate before calling
from factors.registry import _MAX_YAML_BYTES
assert path.stat().st_size <= _MAX_YAML_BYTES, f'{path} too large' Try / catch
try:
_safe_yaml_load(path)
except RegistryError as e:
if 'YAML cap' in str(e): split_yaml(path) Prevention
- Split configs per theme/alpha batch
- Keep bulk data out of YAML configs
When it happens
Trigger: A registry/theme YAML config larger than 5 MB, e.g. thousands of alphas in one file or YAML alias bombs.
Common situations: Machine-generated config files accumulating entries over time, merging many configs into one, or accidentally committing a data dump as YAML.
Related errors
- {path.name}: {size}B exceeds {_MAX_PY_BYTES}B cap
- YAML config is not available because PyYAML is missing
- Agent config must decode to a JSON/YAML object
- unknown panel column: {column}
- invalid {kind} {token!r}: must match {_ID_RE.pattern}
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/5cc147907d69e3a7.
Report an issue: GitHub.