{"record":{"id":"36831dd06a1a7ce1","repo":"HKUDS/Vibe-Trading","slug":"alpha-id-alpha-id-r-not-in-registry","errorCode":null,"errorMessage":"alpha_id {alpha_id!r} not in registry","messagePattern":"alpha_id (.+?) not in registry","errorType":"exception","errorClass":"KeyError","httpStatus":null,"severity":"error","filePath":"agent/src/factors/registry.py","lineNumber":284,"sourceCode":"        zoo: str | None = None,\n        theme: str | None = None,\n        universe: str | None = None,\n    ) -> list[str]:\n        \"\"\"Return alpha IDs matching the (optional) filters.\"\"\"\n        out: list[str] = []\n        for a in self._alphas.values():\n            if zoo is not None and a.zoo != zoo:\n                continue\n            if theme is not None and theme not in a.meta.get(\"theme\", []):\n                continue\n            if universe is not None and universe not in a.meta.get(\"universe\", []):\n                continue\n            out.append(a.id)\n        return sorted(out)\n\n    def get(self, alpha_id: str) -> Alpha:\n        if alpha_id not in self._alphas:\n            raise KeyError(f\"alpha_id {alpha_id!r} not in registry\")\n        return self._alphas[alpha_id]\n\n    def get_source(self, alpha_id: str) -> str:\n        \"\"\"Return the raw .py source of a registered alpha (size-capped).\n\n        Raises:\n            KeyError: alpha_id unknown.\n            RegistryError: source file exceeds ``_MAX_PY_BYTES`` or cannot be read.\n        \"\"\"\n        if alpha_id not in self._alphas:\n            raise KeyError(f\"alpha_id {alpha_id!r} not in registry\")\n        py_path = self._py_paths.get(alpha_id)\n        if py_path is None:\n            raise RegistryError(f\"{alpha_id}: no source path recorded\")\n        try:\n            size = py_path.stat().st_size\n        except OSError as exc:\n            raise RegistryError(f\"{alpha_id}: cannot stat source: {exc}\") from exc","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/factors/registry.py#L266-L302","documentation":"Registry.get(alpha_id) looks up an Alpha by id and raises KeyError when the id is not present in the in-memory registry. This is the standard lookup failure for consumers like _compute_single_alpha, theme_breakdown, run_bench, and run_bench_strict.","triggerScenarios":"Calling registry.get('nonexistent_id'), or passing an alpha id to run_bench that failed to register (e.g. its module had invalid metadata).","commonSituations":"Typos in alpha ids, ids from config referencing alphas that were removed, or zoo modules silently skipped at registration time due to their own errors — check registration logs.","solutions":["List available ids via registry (e.g. sorted(registry._alphas) or the list API used in your version) and fix the id","Verify the target module actually registered; if it was skipped, fix its underlying registration error first","Keep ids in config in one canonical place to avoid drift"],"exampleFix":"# before\nalpha = registry.get('momentum_fast ')\n# after\nalpha = registry.get('momentum_fast')","handlingStrategy":"try-catch","validationCode":"if alpha_id not in registry._alphas: raise KeyError(alpha_id)  # or use a public listing API","typeGuard":"def is_registered(registry, alpha_id: str) -> bool:\n    return alpha_id in registry._alphas","tryCatchPattern":"try:\n    alpha = registry.get(alpha_id)\nexcept KeyError:\n    log.warning(f'unknown alpha {alpha_id}; available: {sorted(registry._alphas)}')\n    raise","preventionTips":["Validate id lists against the registry at startup","Log registration skips so silent failures are visible"],"tags":["registry","key-error","lookup"],"backgroundTag":"unknown-key-lookup","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}