{"record":{"id":"9a72673841b2789d","repo":"HKUDS/Vibe-Trading","slug":"unsupported-platform-query-platform","errorCode":null,"errorMessage":"Unsupported platform: {query.platform}","messagePattern":"Unsupported platform: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/src/skills/social-media-intelligence/SKILL.md","lineNumber":1240,"sourceCode":"    Args:\n        query: Query parameters including platform, keyword, time window, and limit\n\n    Returns:\n        Standardized JSON data containing platform / items / metadata\n\n    Raises:\n        ValueError: Unsupported platform or invalid parameters\n        RuntimeError: API call failed, with retry guidance attached\n    \"\"\"\n    collectors = {\n        Platform.TWITTER: _collect_twitter,\n        Platform.TELEGRAM: _collect_telegram,\n        Platform.DISCORD: _collect_discord,\n        Platform.REDDIT: _collect_reddit,\n    }\n    collector = collectors.get(query.platform)\n    if not collector:\n        raise ValueError(f\"Unsupported platform: {query.platform}\")\n\n    raw_data = collector(query)\n\n    if query.include_sentiment:\n        raw_data = _enrich_with_sentiment(raw_data)\n\n    return raw_data\n```\n\n### 6.2 Environment Variables\n\n```bash\n# Add the following to .env\nTWITTER_BEARER_TOKEN=xxx\nTELEGRAM_API_ID=xxx\nTELEGRAM_API_HASH=xxx\nDISCORD_BOT_TOKEN=xxx\nREDDIT_CLIENT_ID=xxx","sourceCodeStart":1222,"sourceCodeEnd":1258,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/skills/social-media-intelligence/SKILL.md#L1222-L1258","documentation":"The social-media-intelligence skill dispatches data collection through a collectors dict keyed by Platform members (TELEGRAM, DISCORD, REDDIT). If query.platform has no registered collector — unknown enum value, None, or a platform added to the enum but without an implementation — it raises ValueError('Unsupported platform: <platform>').","triggerScenarios":"Calling the collect entrypoint with query.platform set to a Platform member lacking a collector entry, e.g. Platform.TWITTER when only TELEGRAM/DISCORD/REDDIT are mapped, or constructing the query with a raw string that coerces to an unexpected enum value.","commonSituations":"New Platform enum members added before their collectors ship, user-facing platform pickers exposing more options than the backend implements, persisted queries referencing deprecated platforms, or defaulting platform to None.","solutions":["Set query.platform to one of the implemented platforms: Platform.TELEGRAM, Platform.DISCORD, or Platform.REDDIT","If a new platform is required, add a _collect_<platform> function and register it in the collectors mapping","Restrict the client-side platform picker to implemented values"],"exampleFix":"# before\nquery = SocialQuery(platform=Platform.TWITTER, ...)\n\n# after\nquery = SocialQuery(platform=Platform.REDDIT, ...)  # one of TELEGRAM/DISCORD/REDDIT","handlingStrategy":"type-guard","validationCode":"SUPPORTED_PLATFORMS = {Platform.TELEGRAM, Platform.DISCORD, Platform.REDDIT}\n\nif query.platform not in SUPPORTED_PLATFORMS:\n    raise ValueError(f\"platform must be one of {sorted(p.value for p in SUPPORTED_PLATFORMS)}\")","typeGuard":"from enum import Enum\n\ndef is_supported_platform(p) -> bool:\n    return p in {Platform.TELEGRAM, Platform.DISCORD, Platform.REDDIT}","tryCatchPattern":"try:\n    raw = collect(query)\nexcept ValueError as e:\n    if str(e).startswith(\"Unsupported platform\"):\n        return skip_collection(query.platform)\n    raise","preventionTips":["Keep the platform picker/CLI flags in sync with the collectors mapping","Add a test that every Platform enum member has a registered collector","Reject unknown platform strings at the query-construction boundary"],"tags":["enum","dispatch","social-media","unsupported-value"],"backgroundTag":"unsupported-enum-value","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}