{"record":{"id":"308e00d15e16b77e","repo":"HKUDS/Vibe-Trading","slug":"alpha-id-no-source-path-recorded","errorCode":null,"errorMessage":"{alpha_id}: no source path recorded","messagePattern":"(.+?): no source path recorded","errorType":"exception","errorClass":"RegistryError","httpStatus":null,"severity":"error","filePath":"agent/src/factors/registry.py","lineNumber":298,"sourceCode":"        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\n        if size > _MAX_PY_BYTES:\n            raise RegistryError(\n                f\"{alpha_id}: source {size}B exceeds {_MAX_PY_BYTES}B cap\"\n            )\n        try:\n            return py_path.read_text(encoding=\"utf-8\")\n        except OSError as exc:\n            raise RegistryError(f\"{alpha_id}: cannot read source: {exc}\") from exc\n\n    def health(self) -> dict[str, Any]:\n        return {\n            \"loaded\": len(self._alphas),\n            \"failed\": len(self._load_errors),\n            \"errors\": [","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/factors/registry.py#L280-L316","documentation":"Raised by FactorRegistry.get_source when the alpha_id exists in the registry but no Python source path was recorded for it. The registry stores a mapping of alpha ids to .py file paths; if that entry is missing, the source cannot be retrieved. It usually indicates the alpha was registered without filesystem-backed source discovery.","triggerScenarios":"Calling get_source(alpha_id) or get_alpha(alpha_id, include_source=True) for an alpha registered from an installed package (no _py_paths entry), or after a partial registry load that skipped source-path collection.","commonSituations":"Registry built with filesystem loader disabled; alpha registered programmatically rather than scanned from disk; source files moved/deleted between registration and lookup.","solutions":["Check registry.health() to confirm the alpha loaded and inspect how it was registered","Ensure the registry is constructed with filesystem source discovery enabled so _py_paths is populated","Rebuild/reload the registry from the zoo directory before calling get_source"],"exampleFix":"// before\nsrc = registry.get_source('alpha_008')\n// after\nif registry.has_source('alpha_008'):\n    src = registry.get_source('alpha_008')\nelse:\n    src = inspect.getsource(importlib.import_module(module_path))","handlingStrategy":"validation","validationCode":"py_path = registry._py_paths.get(alpha_id) if hasattr(registry, '_py_paths') else None\nif py_path is None:\n    logger.warning('no source recorded; falling back to inspect')","typeGuard":null,"tryCatchPattern":"try:\n    src = registry.get_source(alpha_id)\nexcept RegistryError:\n    src = inspect.getsource(importlib.import_module(registry.get(alpha_id).module_path))","preventionTips":["Build the registry with filesystem source discovery enabled","Call health() after loading to verify registry state"],"tags":["registry","source-code","metadata-missing"],"backgroundTag":"missing-metadata-key","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}