{"record":{"id":"c148d3af2f983952","repo":"HKUDS/Vibe-Trading","slug":"path-name-alphameta-validation-failed-exc","errorCode":null,"errorMessage":"{path.name}: AlphaMeta validation failed: {exc}","messagePattern":"(.+?): AlphaMeta validation failed: (.+?)","errorType":"validation","errorClass":"RegistryError","httpStatus":null,"severity":"error","filePath":"agent/src/factors/registry.py","lineNumber":183,"sourceCode":"        if any(t.id == \"__alpha_meta__\" for t in targets):\n            meta_node = stmt.value\n            break\n\n    if meta_node is None:\n        raise RegistryError(f\"{path.name}: __alpha_meta__ assignment not found\")\n\n    try:\n        raw = ast.literal_eval(meta_node)\n    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:","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/factors/registry.py#L165-L201","documentation":"The dict extracted from __alpha_meta__ is validated against the AlphaMeta pydantic model, which is strict (extra='forbid', frozen). Unknown fields, missing required fields, or wrong value types cause ValidationError wrapped in RegistryError.","triggerScenarios":"Including a field not in the AlphaMeta schema, omitting a required field, or supplying a wrong type (e.g. window: 'five' instead of int).","commonSituations":"Schema evolution after upgrading the library (renamed fields), hand-copied metadata from another repo with extra keys, or forgetting newly-required fields in generated alphas.","solutions":["Read the wrapped pydantic error to see the exact field problem","Remove unknown keys and add missing required keys per the current AlphaMeta schema","Regenerate alphas with the current template after library upgrades"],"exampleFix":"# before\n__alpha_meta__ = {'alpha_id': 'x', 'author': 'me'}  # 'author' unknown\n# after\n__alpha_meta__ = {'alpha_id': 'x'}  # only schema fields","handlingStrategy":"try-catch","validationCode":"from factors.registry import AlphaMeta\nAlphaMeta(**raw)  # dry-run validation before register","typeGuard":null,"tryCatchPattern":"try:\n    AlphaMeta(**raw)\nexcept ValidationError as e:\n    print(f'fix fields: {e.errors()}')  # each item shows loc/msg","preventionTips":["Regenerate alphas from the current template after upgrades","Read pydantic error.errors() to pinpoint offending fields"],"tags":["registry","pydantic","schema-validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}