{"record":{"id":"5cc147907d69e3a7","repo":"HKUDS/Vibe-Trading","slug":"path-name-size-b-exceeds-max-yaml-bytes-b-ya","errorCode":null,"errorMessage":"{path.name}: {size}B exceeds {_MAX_YAML_BYTES}B YAML cap","messagePattern":"(.+?): (.+?)B exceeds (.+?)B YAML cap","errorType":"exception","errorClass":"RegistryError","httpStatus":null,"severity":"error","filePath":"agent/src/factors/registry.py","lineNumber":192,"sourceCode":"    except (ValueError, SyntaxError) as exc:\n        raise RegistryError(f\"{path.name}: __alpha_meta__ not a literal: {exc}\") from exc\n\n    if not isinstance(raw, dict):\n        raise RegistryError(f\"{path.name}: __alpha_meta__ must be dict, got {type(raw).__name__}\")\n\n    try:\n        return AlphaMeta(**raw)\n    except ValidationError as exc:\n        raise RegistryError(f\"{path.name}: AlphaMeta validation failed: {exc}\") from exc\n\n\ndef _safe_yaml_load(path: Path) -> Any:\n    \"\"\"yaml.safe_load with hard 5 MB size cap (defence in depth).\"\"\"\n    import yaml  # local import keeps registry import-light\n\n    size = path.stat().st_size\n    if size > _MAX_YAML_BYTES:\n        raise RegistryError(f\"{path.name}: {size}B exceeds {_MAX_YAML_BYTES}B YAML cap\")\n    text = path.read_text(encoding=\"utf-8\")\n    return yaml.safe_load(text)\n\n\ndef _zoo_dir_default() -> Path:\n    return Path(__file__).parent / \"zoo\"\n\n\nclass Registry:\n    \"\"\"In-memory registry of all discoverable alphas across zoo subdirectories.\"\"\"\n\n    def __init__(self, zoo_root: Path | None = None) -> None:\n        default_root = _zoo_dir_default()\n        self._zoo_root = (zoo_root or default_root).resolve()\n        # When the registry points at the bundled zoo dir, modules are loaded\n        # by package name (warm import cache, supports relative imports). For\n        # any other zoo_root (tests, plugins) we load by file path so the\n        # caller doesn't have to fiddle with sys.path.","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/factors/registry.py#L174-L210","documentation":"_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.","triggerScenarios":"A registry/theme YAML config larger than 5 MB, e.g. thousands of alphas in one file or YAML alias bombs.","commonSituations":"Machine-generated config files accumulating entries over time, merging many configs into one, or accidentally committing a data dump as YAML.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from factors.registry import _MAX_YAML_BYTES\nassert path.stat().st_size <= _MAX_YAML_BYTES, f'{path} too large'","typeGuard":null,"tryCatchPattern":"try:\n    _safe_yaml_load(path)\nexcept RegistryError as e:\n    if 'YAML cap' in str(e): split_yaml(path)","preventionTips":["Split configs per theme/alpha batch","Keep bulk data out of YAML configs"],"tags":["registry","yaml","file-size-cap"],"backgroundTag":"file-size-limit-exceeded","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}