{"record":{"id":"a01e743d69b3f512","repo":"HKUDS/Vibe-Trading","slug":"alpha-id-panel-missing-sector-tag","errorCode":null,"errorMessage":"{alpha_id}: panel missing sector tag","messagePattern":"(.+?): panel missing sector tag","errorType":"validation","errorClass":"SkipAlpha","httpStatus":null,"severity":"warning","filePath":"agent/src/factors/registry.py","lineNumber":339,"sourceCode":"    def compute(self, alpha_id: str, panel: dict[str, pd.DataFrame]) -> pd.DataFrame:\n        \"\"\"Lazy-import the alpha module and run its ``compute(panel)``.\n\n        Raises:\n            KeyError: alpha_id unknown.\n            SkipAlpha: required column / sector tag absent in panel.\n            RegistryError: import/compute failed or output failed sanity checks.\n        \"\"\"\n        alpha = self.get(alpha_id)\n        meta = alpha.meta\n\n        missing = [c for c in meta.get(\"columns_required\", []) if c not in panel]\n        if missing:\n            raise SkipAlpha(f\"{alpha_id}: panel missing required columns {missing}\")\n        missing_extra = [c for c in meta.get(\"extras_required\", []) if c not in panel]\n        if missing_extra:\n            raise SkipAlpha(f\"{alpha_id}: panel missing extras {missing_extra}\")\n        if meta.get(\"requires_sector\") and \"sector\" not in panel:\n            raise SkipAlpha(f\"{alpha_id}: panel missing sector tag\")\n\n        try:\n            module = self._load_module(alpha)\n        except Exception as exc:  # noqa: BLE001 — isolate import failure\n            raise RegistryError(f\"{alpha_id}: import failed: {exc}\") from exc\n\n        compute_fn = getattr(module, \"compute\", None)\n        if compute_fn is None:\n            raise RegistryError(f\"{alpha_id}: module has no compute() function\")\n\n        try:\n            result = compute_fn(panel)\n        except Exception as exc:  # noqa: BLE001 — isolate compute failure\n            raise RegistryError(f\"{alpha_id}: compute() raised: {exc}\") from exc\n\n        return self._validate_output(alpha_id, result, panel)\n\n    def _load_module(self, alpha: Alpha) -> ModuleType:","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/factors/registry.py#L321-L357","documentation":"The alpha's metadata sets requires_sector=True but the panel dict has no 'sector' key. compute() raises SkipAlpha before importing the module, since sector-aware factors cannot run without sector tags.","triggerScenarios":"compute(alpha_id, panel) on an industry/neutrality-style factor without providing panel['sector'] (a wide DataFrame of sector labels).","commonSituations":"Panels built from price-only data with no classification data joined in; forgetting that sector is passed as a panel key, not a constructor option.","solutions":["Add panel['sector'] as a wide DataFrame aligned to the price index","Use sector-agnostic alphas if you have no classification data","Check meta['requires_sector'] upfront and filter your alpha list"],"exampleFix":"# before\nout = registry.compute(sector_alpha_id, panel)\n# after\npanel['sector'] = sector_df  # same index/columns as close\nout = registry.compute(sector_alpha_id, panel)","handlingStrategy":"validation","validationCode":"if registry.get(alpha_id).meta.get('requires_sector') and 'sector' not in panel:\n    skip(alpha_id)","typeGuard":"def sector_ready(meta: dict, panel: dict) -> bool:\n    return not meta.get('requires_sector') or 'sector' in panel","tryCatchPattern":"try:\n    out = registry.compute(aid, panel)\nexcept SkipAlpha:\n    continue","preventionTips":["Join sector classification into panels at build time","Filter sector-requiring alphas when classification data is absent"],"tags":["data-validation","sector","panel"],"backgroundTag":"missing-required-column","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}