{"record":{"id":"7a889aa54ed95bb8","repo":"HKUDS/Vibe-Trading","slug":"invalid-alpha-id-aid-r","errorCode":null,"errorMessage":"invalid alpha_id {aid!r}","messagePattern":"invalid alpha_id (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":422,"severity":"error","filePath":"agent/src/api/alpha_routes.py","lineNumber":195,"sourceCode":"\n\nclass CompareRequest(BaseModel):\n    \"\"\"POST /alpha/compare body — a head-to-head of >= 2 named alphas.\"\"\"\n\n    alpha_ids: list[str] = Field(..., min_length=2, max_length=50)\n    universe: str = Field(..., min_length=1, max_length=64)\n    period: str = Field(..., min_length=4, max_length=32)\n    sort: str = Field(\"ir\", min_length=1, max_length=32)\n\n    @field_validator(\"alpha_ids\")\n    @classmethod\n    def _ids_well_formed(cls, v: list[str]) -> list[str]:\n        # De-duplicate (preserve order) and validate each id shape.\n        seen: set[str] = set()\n        out: list[str] = []\n        for aid in v:\n            if not _ALPHA_ID_RE.fullmatch(aid or \"\"):\n                raise ValueError(f\"invalid alpha_id {aid!r}\")\n            if aid not in seen:\n                seen.add(aid)\n                out.append(aid)\n        if len(out) < 2:\n            raise ValueError(\"need at least 2 distinct alpha_ids to compare\")\n        return out\n\n    @field_validator(\"universe\")\n    @classmethod\n    def _universe_known(cls, v: str) -> str:\n        if v not in _BENCH_UNIVERSES:\n            raise ValueError(\n                f\"unknown universe {v!r}; expected one of {sorted(_BENCH_UNIVERSES)}\"\n            )\n        return v\n\n    @field_validator(\"sort\")\n    @classmethod","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/api/alpha_routes.py#L177-L213","documentation":"This NotImplementedError is part of the scaffold template (plugin_scaffold.py) written into newly created connectors. It marks get_account_snapshot as an unimplemented stub the developer must fill in by calling their broker's account endpoint and returning a normalized account envelope. Hitting it at runtime means the scaffold was installed without being implemented.","triggerScenarios":"Scaffolding a connector, installing it, and calling get_account/check_connection before replacing the stub body; the stub raises immediately since it has no logic.","commonSituations":"Developer installs the starter to test the pipeline and forgets the stubs raise; partial implementation where positions was filled in but account snapshot was not.","solutions":["Implement get_account_snapshot in the adapter to call the broker account API and return the normalized envelope dict (include missing_fields/readonly style keys per the scaffold's check_status shape)","Reinstall the connector so the installed copy under plugin root picks up the edit","Until implemented, avoid routing account reads to this profile"],"exampleFix":"# before\ndef get_account_snapshot(*, credentials, config):\n    raise NotImplementedError(\"Call the broker account endpoint...\")\n\n# after\ndef get_account_snapshot(*, credentials, config):\n    resp = broker_client(credentials).get_account()\n    return {\n        \"account_id\": resp[\"id\"],\n        \"equity\": float(resp[\"equity\"]),\n        \"cash\": float(resp[\"cash\"]),\n        \"currency\": resp.get(\"currency\", \"USD\"),\n    }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"def snapshot_implemented(adapter) -> bool:\n    import inspect\n    fn = getattr(adapter, \"get_account_snapshot\", None)\n    return callable(fn) and not _is_stub(fn)\n\ndef _is_stub(fn) -> bool:\n    src = inspect.getsource(fn)\n    return \"NotImplementedError\" in src","tryCatchPattern":"try:\n    snapshot = _local_plugin_call(profile, \"get_account_snapshot\", overrides)\nexcept NotImplementedError:\n    fallback_to_manual_refresh_or_skip()  # scaffold stub; not yet implemented","preventionTips":["Never install a scaffold with stub bodies into production profiles","CI-check that installed adapters contain no NotImplementedError in source","Track implementation status per connector before selecting its profile"],"tags":["scaffold","not-implemented","local-connector","trading"],"backgroundTag":"notimplementederror-stub","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}